gcc/libstdc++-v3/include
Jonathan Wakely ef5d671cd8 libstdc++: Fix std::regex_replace for strings with embedded null [PR103664]
The overload of std::regex_replace that takes a std::basic_string as the
fmt argument (for the replacement string) is implemented in terms of the
one taking a const C*, which uses std::char_traits to find the length.
That means it stops at a null character, even though the basic_string
might have additional characters beyond that.

Rather than duplicate the implementation of the const C* one for the
std::basic_string case, this moves that implementation to a new
__regex_replace function which takes a const C* and a length. Then both
the std::basic_string and const C* overloads can call that (with the
latter using char_traits to find the length to pass to the new
function).

libstdc++-v3/ChangeLog:

	PR libstdc++/103664
	* include/bits/regex.h (__regex_replace): Declare.
	(regex_replace): Use it.
	* include/bits/regex.tcc (__regex_replace): Replace regex_replace
	definition with __regex_replace.
	* testsuite/28_regex/algorithms/regex_replace/char/103664.cc: New test.
2021-12-13 11:11:30 +00:00
..
backward Update copyright years. 2021-01-04 10:26:59 +01:00
bits libstdc++: Fix std::regex_replace for strings with embedded null [PR103664] 2021-12-13 11:11:30 +00:00
c Update copyright years. 2021-01-04 10:26:59 +01:00
c_compatibility Update copyright years. 2021-01-04 10:26:59 +01:00
c_global libstdc++: Enable type traits for wchar_t unconditionally [PR98725] 2021-10-09 00:57:49 +01:00
c_std Update copyright years. 2021-01-04 10:26:59 +01:00
debug libstdc++: Define std::__is_constant_evaluated() for internal use 2021-12-01 15:00:33 +00:00
decimal libstdc++: Fix doxygen markup for group close commands 2021-04-06 16:43:24 +01:00
experimental libstdc++: Fix non-reserved name in std::allocator base class [PR64135] 2021-12-09 22:50:10 +00:00
ext libstdc++: Fix non-reserved name in std::allocator base class [PR64135] 2021-12-09 22:50:10 +00:00
parallel Update copyright years. 2021-01-04 10:26:59 +01:00
precompiled libstdc++: Implement std::spanstream for C++23 2021-11-13 11:45:31 +00:00
pstl libstdc++: Fix up parallel_backend_serial.h [PR97549] 2021-02-23 09:28:14 +01:00
std libstdc++: Make atomic<T*>::wait() const [PR102994] 2021-12-09 17:57:03 -08:00
tr1 libstdc++: Enable type traits for wchar_t unconditionally [PR98725] 2021-10-09 00:57:49 +01:00
tr2 libstdc++: Fix doxygen markup for group close commands 2021-04-06 16:43:24 +01:00
Makefile.am libstdc++: Fix non-reserved name in std::allocator base class [PR64135] 2021-12-09 22:50:10 +00:00
Makefile.in libstdc++: Fix non-reserved name in std::allocator base class [PR64135] 2021-12-09 22:50:10 +00:00