[dvblast-devel] Compile failure on x86_64

Alexei Takaseev alexei at taf.ru
Tue Oct 2 15:59:12 CEST 2012



----- Исходное сообщение -----
> От: "Georgi Chorbadzhiyski" <gf at unixsol.org>
> Кому: "Alexei Takaseev" <alexei at taf.ru>
> Копия: "Mailing list for DVBlast developers" <dvblast-devel at videolan.org>
> Отправленные: Вторник, 2 Октябрь 2012 г 18:37:21
> Тема: Re: [dvblast-devel] Compile failure on x86_64
> 
> Around 10/02/2012 12:25 PM, Alexei Takaseev scribbled:
> >> On 10/2/12 8:11 AM, Alexei Takaseev wrote:
> >>> System ALT Linux Sisuphus 01-10-2012
> >>> arch x86_64
> >>> glibc 2.16
> >>> gcc version 4.7.2 20120920 (ALT Linux 4.7.2-alt2) (GCC)
> >>>
> >>> Compile failure on x86_64 with:
> > ....
> >>> In file included from /usr/include/string.h:656:0,
> >>>                   from en50221.c:30:
> >>> In function 'memcpy',
> >>>      inlined from 'TPDUSend.constprop.35' at en50221.c:318:19,
> >>>      inlined from 'SPDUSend' at en50221.c:500:26:
> >>> /usr/include/bits/string3.h:51:3: error: call to
> >>> __builtin___memcpy_chk will always overflow destination buffer
> >>> make: *** [en50221.o] Error 1
> >>> make: Leaving directory `/usr/src/RPM/BUILD/dvblast-2.2'
> >>> ===========================================================
> >>>
> >>> On the i586 architecture there are no compilation errors.
> >>>
> >>> Has anyone successfully compiled with the combination of x86_64 +
> >>> gcc 4.7 + glibc 2.16 + last dvblast of git?
> >>
> >> Ok, I don't see it:
> >>
> >>      313     case T_DATA_LAST:
> >>      314     case T_DATA_MORE:
> >>      315     {
> >>      316         /* i_length <= MAX_TPDU_DATA */
> >>      317         uint8_t *p = p_data + 3;
> >>      318         p = SetLength( p, i_length + 1 );
> >>      319         *p++ = i_tcid;
> >>      320
> >>      321         if ( i_length )
> >>      322             memcpy( p, p_content, i_length );
> >>      323             i_size = i_length + (p - p_data);
> >>      324         }
> >>      325         break;
> >>
> >> The memcpy will overflow if i_length is > MAX_TPDU_DATA but we
> >> never called this function with more than MAX_TPDU_DATA set as
> >> i_length.
> >> Am I missing something?
> >>
> >> This patch probably wrong, but please try it to see if the error
> >> goes
> >> away:
> >>
> >> diff --git a/en50221.c b/en50221.c
> >> index 0724fb3..049c5c2 100644
> >> --- a/en50221.c
> >> +++ b/en50221.c
> >> @@ -205,7 +205,7 @@ static uint8_t *SetLength( uint8_t *p_data,
> >> int
> >> i_length )
> >>    */
> >>
> >>   #define MAX_TPDU_SIZE  4096
> >> -#define MAX_TPDU_DATA  (MAX_TPDU_SIZE - 4)
> >> +#define MAX_TPDU_DATA  (MAX_TPDU_SIZE - 8)
> >>
> >>   #define DATA_INDICATOR 0x80
> > 
> > The compilation process stopped in the same place with the same
> > error.
> 
> In that case as far as I can see this not a bug in dvblast.
> 
> Try with glibc != 2.16 because the bug probably there. With 2.15
> there are
> no such problems.

I'm sorry, due to an error in the spec-file compilation is done without changes in en50221.c.

Successful compilation of such revisions occurred when:

commit 8ae489aa5d6e2d742e1bf6ba1f4db06549eb2712
Author: Alexei Takaseev <taf at altlinux.org>
Date: Tue Oct 2 22:44:01 2012 0900

     Fix build by gcc 4.7 on x86_64

diff - git a/en50221.c b/en50221.c
index 0724fb3 .. 13a2319 100644
--- a/en50221.c
+ + + B/en50221.c
@ @ -205,7 +205,7 @ @ Static uint8_t * SetLength (uint8_t * p_data, int i_length)
   * /

  # define MAX_TPDU_SIZE 4096
- # define MAX_TPDU_DATA (MAX_TPDU_SIZE - 4)
+ # define MAX_TPDU_DATA (MAX_TPDU_SIZE - 7)

  # define DATA_INDICATOR 0x80

that is not initially considered 3 bytes.


More information about the dvblast-devel mailing list