Opened 15 years ago

Closed 15 years ago

Last modified 11 years ago

#2896 closed defect (fixed)

GetFieldAsString() fails (aborts) on Ubuntu 8.10

Reported by: Even Rouault Owned by: Even Rouault
Priority: normal Milestone:
Component: OGR_SF Version: unspecified
Severity: normal Keywords:
Cc: warmerdam

Description

It appears that in Ubuntu 8.10 and later versions, -D_FORTIFY_SOURCE=2 is set by default, and is activated when -O is set to 2 or higher. This enables additional compile-time and run-time checks for several libc functions.

The consequence of this is that :

int main()
{
  char s[5];
  snprintf(s, 100, "%d", 1234);
  printf("%s\n", s);
  return 0;
}

will ABORT when it is compiled in -O2 (unless -U_FORTIFY_SOURCE or -D_FORTIFY_SOURCE=0 are defined)

We have a similar pattern in ogr_feature.cpp.

Change History (4)

comment:1 by Even Rouault, 15 years ago

Milestone: 1.5.5
Resolution: fixed
Status: newclosed

Fixed in trunk (r16611), branches/1.6 (r16612) and branches/1.5 (r16613).

Thanks to darblue_B for reporting and Nowak for pointer on D_FORTIFY_SOURCE=2

comment:2 by russnelson, 14 years ago

Still aborts on Ubuntu 9.10. Seems to be running into fortify still:

/lib/tls/i686/cmov/libc.so.6(fortify_fail+0x48)[0xb7660de8] /lib/tls/i686/cmov/libc.so.6[0xb765fe20] /lib/tls/i686/cmov/libc.so.6[0xb765f779] /lib/tls/i686/cmov/libc.so.6(snprintf_chk+0x34)[0xb765f664] /usr/lib/libgdal1.5.0.so.1(_ZN10OGRFeature16GetFieldAsStringEi+0x34e)[0xb72953be] /usr/lib/libgdal1.5.0.so.1(OGR_F_GetFieldAsString+0x28)[0xb72961c8]

comment:3 by Even Rouault, 14 years ago

Yes, the reason is simple : the Ubuntu maintener(s) haven't applied the patches...

comment:4 by Even Rouault, 11 years ago

Milestone: 1.5.5

Milestone 1.5.5 deleted

Note: See TracTickets for help on using tickets.