Skip to content
Snippets Groups Projects
Commit 988dd22e authored by Jonathan Wakely's avatar Jonathan Wakely
Browse files

libstdc++: Fix allocator propagation in regex algorithms [PR107376]

The PR points out that we assume the match_results allocator is default
constuctible, which might not be true. We also have a related issue with
unwanted propagation from an object that might have an unequal
allocator.

Ideally we use the same allocator type for _State_info::_M_match_queue
but that would be an ABI change now. We should investigate if that can
be done without breaking anything, which might be possible because the
_Executor object is short-lived and never leaks out of the regex_match,
regex_search, and regex_replace algorithms. If we change the mangled
name for _Executor then there would be no ODR violations when mixing old
and new definitions. This commit does not attempt that.

libstdc++-v3/ChangeLog:

	PR libstdc++/107376
	* include/bits/regex_executor.h (_Executor::_Executor): Use same
	allocator for _M_cur_results and _M_results.
	* include/bits/regex_executor.tcc (_Executor::_M_main_dispatch):
	Prevent possibly incorrect allocator propagating to
	_M_cur_results.
	* testsuite/28_regex/algorithms/regex_match/107376.cc: New test.
parent 95decac3
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment