*** buffer overflow detected *** error

Brian Dessent brian@dessent.net
Sat Nov 29 02:55:00 GMT 2008


ying lcs wrote:

> And when I compile the same code in Ubuntu 8.04. It works. But now I
> do that in Ubuntu 8.10. I get this error:

The difference is due to 8.10 adding -D_FORTIFY_SOURCE=2 to the default
CFLAGS which enables extra compile-time and run-time checking above and
beyond what is normal.  See
<https://wiki.ubuntu.com/CompilerFlags#-D_FORTIFY_SOURCE=2>.  So the
only reason you didn't see it before was not because there did not exist
a (potential) problem but only because this extra level of checking
wasn't enabled.

The runtime abort may be a false positive, or it may be indicative of a
real bug.  From your backtrace it is the checked replacement version of
realpath() that is causing the abort, which probably means that the code
in question in XPCOMGlueLoad() is passing a buffer that's too small as
the second argument to the call to realpath.  Either fix the call or
turn down the checking level to 1 or 0.

Brian



More information about the Gcc-help mailing list