This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/63631] std::regex_match yielding inexplicable garbage; invalid reads in valgrind


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63631

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID
           Severity|major                       |normal

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
words_begin->str().c_str() returns a dangling pointer, because
words_begin->str() returns a temporary that immediately goes out of scope.

This means your regex_match() call fills the match_results object with pointers
into a deallocated string


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]