Ticket #2896 (closed defect: fixed)

Opened 3 years ago

Last modified 2 years ago

GetFieldAsString() fails (aborts) on Ubuntu 8.10

Reported by: rouault Owned by: rouault
Priority: normal Milestone: 1.5.5
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

Changed 3 years ago by rouault

  • status changed from new to closed
  • resolution set to fixed
  • milestone set to 1.5.5

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

Changed 2 years ago by russnelson

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]

Changed 2 years ago by rouault

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

Note: See TracTickets for help on using tickets.