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

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #2)
> Right, the program is using std::regex incorrectly, and has undefined
> behaviour.
> 
> Compiling with -D_GLIBCXX_ASSERTIONS will cause the program to abort at
> runtime:
> 
> /home/jwakely/gcc/8/include/c++/8.3.1/bits/regex_scanner.tcc:189: void
> std::__detail::_Scanner<_CharT>::_M_scan_normal() [with _CharT = char]:
> Assertion 'false' failed.
> Aborted (core dumped)

That assertion no longer fails, because since I fixed PR 84110 the null zero at
the end of the input string no longer reaches that assertion. Instead we just
walk off the end of the string, and keep going until we reach the address of
the second string literal.

I'm not sure how to detect this reliably. I don't think we can, without some
new GCC object size checking builtins to check if two pointers are both part of
the same object.

With -fsanitize=address you will get an error at runtime.

The assertion that no longer fails could still be clarified though.

Reply via email to