[Boost-bugs] [Boost C++ Libraries] #5911: Crash in Boost::regex when _GLIBCXX_DEBUG is defined

Subject: [Boost-bugs] [Boost C++ Libraries] #5911: Crash in Boost::regex when _GLIBCXX_DEBUG is defined
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-09-19 00:57:42


#5911: Crash in Boost::regex when _GLIBCXX_DEBUG is defined
--------------------------------+-------------------------------------------
 Reporter: noloader@… | Owner: johnmaddock
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: regex
  Version: Boost 1.47.0 | Severity: Problem
 Keywords: regex match crash |
--------------------------------+-------------------------------------------
 Regex matching experiences a crash when _GLIBCXX_DEBUG is defined.

 The crash was confirmed on multiple platforms, including Ubuntu, Fedora,
 and openBSD.

 Full compiler command: g++ -D_GLIBCXX_DEBUG -DDEBUG=1 -g3 -ggdb -O0 regex-
 test.cpp -o regex-test.exe -lboost_regex

 $ cat regex-test.cpp
 #include <boost/regex.hpp>

 int main(int, char**)
 {
     const boost::regex re("^[a-zA-Z]*");
     bool match = boost::regex_match("asdf",re);

     return (int) !match;
 }


 $ ./regex-test.exe
 Segmentation fault (core dumped)
 $ gdb ./regex-test.exe
 GNU gdb 6.3
 Copyright 2004 Free Software Foundation, Inc.
 GDB is free software, covered by the GNU General Public License, and you
 are
 welcome to change it and/or distribute copies of it under certain
 conditions.
 Type "show copying" to see the conditions.
 There is absolutely no warranty for GDB. Type "show warranty" for
 details.
 This GDB was configured as "i386-unknown-openbsd4.9"...
 (gdb) r
 Starting program: /home/jeffrey/Desktop/regex-test.exe

 Program received signal SIGSEGV, Segmentation fault.
 0x01c6fc26 in __gnu_debug::_Safe_iterator_base::_M_detach_single (
     this=0x3c0000f9)
     at
 /usr/src/gnu/lib/libstdc++-v3/../../gcc/libstdc++-v3/src/debug.cc:242
 242 _M_prior->_M_next = _M_next;
 (gdb) bt full
 #0 0x01c6fc26 in __gnu_debug::_Safe_iterator_base::_M_detach_single (
     this=0x3c0000f9)
     at
 /usr/src/gnu/lib/libstdc++-v3/../../gcc/libstdc++-v3/src/debug.cc:242
 No locals.
 #1 0x01c710be in __gnu_debug::_Safe_sequence_base::_M_detach_all (
     this=0xcfbd3a60)
     at
 /usr/src/gnu/lib/libstdc++-v3/../../gcc/libstdc++-v3/src/debug.cc:118
         __iter = (__gnu_debug::_Safe_iterator_base *) 0x65707974
 #2 0x1c00807b in ~_Safe_sequence_base (this=0xcfbd3a60) at
 safe_base.h:185
 No locals.
 #3 0x1c00808f in ~_Safe_sequence (this=0xcfbd3a60) at safe_sequence.h:103
 No locals.
 #4 0x1c0080a9 in ~vector (this=0xcfbd3a54) at vector:101
 No locals.
 #5 0x1c008194 in ~match_results (this=0xcfbd3a54) at
 match_results.hpp:103
 No locals.
 #6 0x1c008655 in boost::regex_match<char, boost::regex_traits<char,
 boost::cpp_regex_traits<char> > > (str=0x3c0000f9 "asdf", e=@0xcfbd3ac4,
     flags=boost::regex_constants::match_default) at regex_match.hpp:90
         m = {
   m_subs = {<std::__norm::vector<boost::sub_match<const
 char*>,std::allocator<boost::sub_match<const char*> > >> =
 {<std::__norm::_Vector_base<boost::sub_match<const
 char*>,std::allocator<boost::sub_match<const char*> > >> = {
         _M_impl = {<std::allocator<boost::sub_match<const char*> >> =
 {<__gnu_cxx::new_allocator<boost::sub_match<const char*> >> = {<No data
 fields>}, <No data fields>}, _M_start = 0x88c4f100, _M_finish =
 0x88c4f124,
           _M_end_of_storage = 0x88c4f124}}, <No data fields>},
 <__gnu_debug::_Safe_sequence<std::__debug::vector<boost::sub_match<const
 char*>, std::allocator<boost::sub_match<const char*> > > >> =
 {<__gnu_debug::_Safe_sequence_base> = {
         _M_iterators = 0x3c0000f9, _M_const_iterators = 0x0,
         _M_version = 1}, <No data fields>}, _M_guaranteed_capacity = 0},
   m_base = 0x85509400 "x\177�'",
   m_null = {<std::pair<const char*,const char*>> = {first = 0x3c0000fd "",
       second = 0x3c0000fd ""}, matched = false}, m_named_subs = {px = 0x0,
     pn = {pi_ = 0x0}}, m_last_closed_paren = 0, m_is_singular = false}
 #7 0x1c005324 in main () at regex-test.cpp:8
         re = {<boost::regbase> = {<No data fields>}, m_pimpl = {
     px = 0x85509400, pn = {pi_ = 0x8ab55140}}}
         match = 28
 (gdb)

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/5911>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:07 UTC