aboutsummaryrefslogtreecommitdiff
path: root/gcc/config.gcc
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2021-09-29 13:48:11 +0100
committerJonathan Wakely <jwakely@redhat.com>2021-09-29 13:48:11 +0100
commitb701e1f8f6870c0f8cb4050674da489101dd05a5 (patch)
tree890c89e93d92bf94e4028a2c309be6cfe012ba0e /gcc/config.gcc
parentb59be1adbaea022f19dc7c30d9bf5089e80795d9 (diff)
downloadgcc-b701e1f8f6870c0f8cb4050674da489101dd05a5.zip
gcc-b701e1f8f6870c0f8cb4050674da489101dd05a5.tar.gz
gcc-b701e1f8f6870c0f8cb4050674da489101dd05a5.tar.bz2
libstdc++: std::basic_regex should treat '\0' as an ordinary char [PR84110]
When the input sequence contains a _CharT(0) character, the strchr call in _Scanner<_CharT>::_M_scan_normal() will search for '\0' and so return a pointer to the terminating null at the end of the string. This makes the scanner think it's found a special character. Because it doesn't match any of the actual special characters, we fall off the end of the function (or assert in debug mode). We should check for a null character explicitly and either treat it as an ordinary character (for the ECMAScript grammar) or an error (for all others). I'm not 100% sure that's right, but it seems consistent with the POSIX RE rules where a '\0' means the end of the regex pattern or the end of the sequence being matched. Signed-off-by: Jonathan Wakely <jwakely@redhat.com> libstdc++-v3/ChangeLog: PR libstdc++/84110 * include/bits/regex_error.h (regex_constants::_S_null): New error code for internal use. * include/bits/regex_scanner.tcc (_Scanner::_M_scan_normal()): Check for null character. * testsuite/28_regex/basic_regex/84110.cc: New test.
Diffstat (limited to 'gcc/config.gcc')
0 files changed, 0 insertions, 0 deletions