* add failing test case
* fix issue #232
Credit to OSS-Fuzz for finding the problematic test regexes and configurations.
This commit is contained in:
Christian Mazakas
2024-12-05 05:08:52 -08:00
committed by GitHub
parent f0afa5d9b8
commit 0cbaa4ef17
4 changed files with 94 additions and 14 deletions

View File

@ -60,12 +60,7 @@ void perl_matcher<BidiIterator, Allocator, traits>::construct_init(const basic_r
if(e.empty())
{
// precondition failure: e is not a valid regex.
std::invalid_argument ex("Invalid regular expression object");
#ifndef BOOST_REGEX_STANDALONE
boost::throw_exception(ex);
#else
throw e;
#endif
BOOST_REGEX_DETAIL_THROW(std::invalid_argument("Invalid regular expression object"));
}
pstate = 0;
m_match_flags = f;
@ -98,7 +93,11 @@ void perl_matcher<BidiIterator, Allocator, traits>::construct_init(const basic_r
match_any_mask = static_cast<unsigned char>((f & match_not_dot_newline) ? BOOST_REGEX_DETAIL_NS::test_not_newline : BOOST_REGEX_DETAIL_NS::test_newline);
// Disable match_any if requested in the state machine:
if(e.get_data().m_disable_match_any)
{
if (m_match_flags & match_posix)
BOOST_REGEX_DETAIL_THROW(std::logic_error("Invalid regex for POSIX-style matching"));
m_match_flags &= regex_constants::match_not_any;
}
}
#ifdef BOOST_REGEX_MSVC
# pragma warning(pop)