http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58841

            Bug ID: 58841
           Summary: std::bad_alloc not thrown with -fsanitize=address
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jaak at ristioja dot ee

I found this bug after a NULL pointer dereference:

// test.cpp
int main() {
  return (new char[8010463299950541741]) != 0;
}


$ g++-4.8.1 -fsanitize=address test.cpp -o test && ./test ; echo $?
==7913== WARNING: AddressSanitizer failed to allocate 0x6f2ae1ee17dafbad bytes
0


$ g++-4.8.1 test.cpp -o test && ./test ; echo $?
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
Aborted
134


$ g++-4.8.1 -v
Using built-in specs.
COLLECT_GCC=g++-4.8.1
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/4.8.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with:
/var/tmp/portage/sys-devel/gcc-4.8.1-r1/work/gcc-4.8.1/configure --prefix=/usr
--bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.8.1
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.1/include
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.8.1
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.8.1/man
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.8.1/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.1/include/g++-v4
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec
--disable-fixed-point --with-cloog --disable-isl-version-check --disable-lto
--disable-nls --with-system-zlib --enable-obsolete --disable-werror
--enable-secureplt --enable-multilib --with-multilib-list=m32,m64
--enable-libmudflap --disable-libssp --enable-libgomp
--with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.8.1/python
--enable-checking=release --disable-libgcj --enable-libstdcxx-time
--enable-languages=c,c++,go,fortran --enable-shared --enable-threads=posix
--enable-__cxa_atexit --enable-clocale=gnu --enable-targets=all
--with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.8.1-r1 p1.2,
pie-0.5.7'
Thread model: posix
gcc version 4.8.1 (Gentoo 4.8.1-r1 p1.2, pie-0.5.7)

Reply via email to