[Bug libstdc++/70459] New: regex segfault on long sequences
chaoskeeper at mail dot ru
gcc-bugzilla@gcc.gnu.org
Wed Mar 30 14:25:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70459
Bug ID: 70459
Summary: regex segfault on long sequences
Product: gcc
Version: 5.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: chaoskeeper at mail dot ru
Target Milestone: ---
A detailed description and tests are given at SO
(http://stackoverflow.com/questions/36304204/%D0%A1-regex-segfault-on-long-sequences),
in short
std::regex r("\\s+");
std::string out = std::regex_replace(cstring, r, " ");
crashes with SIGSEGV on strings with long space sequences (-O3 can handle
around 20k spaces, -O0 handles 12k). Clang produce similar results. Switching
to libc++ cures the crashes.
Crash dump shows lengthy stack (35k frames) of
std::__detail::_Executor<char*, std::allocator<std::__cxx11::sub_match<char*>
>, std::__cxx11::regex_traits<char>, true>::_M_dfs
calls.
GCC:
Configured with: /build/gcc-multilib/src/gcc-5-20160209/configure --prefix=/usr
--libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared
--enable-threads=posix --enable-libmpx --with-system-zlib --with-isl
--enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu
--disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object
--enable-linker-build-id --enable-lto --enable-plugin
--enable-install-libiberty --with-linker-hash-style=gnu
--enable-gnu-indirect-function --enable-multilib --disable-werror
--enable-checking=release
Thread model: posix
gcc version 5.3.0 (GCC)
More information about the Gcc-bugs
mailing list