From ed48905c5e44ef35402daa98a6a8661a46e53a93 Mon Sep 17 00:00:00 2001 From: John Maddock Date: Wed, 11 Jun 2003 12:11:17 +0000 Subject: [PATCH] Added check for invalid regular expression in matching code. [SVN r18777] --- include/boost/regex/v4/perl_matcher_common.hpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/include/boost/regex/v4/perl_matcher_common.hpp b/include/boost/regex/v4/perl_matcher_common.hpp index d339f907..c3ce7d7b 100644 --- a/include/boost/regex/v4/perl_matcher_common.hpp +++ b/include/boost/regex/v4/perl_matcher_common.hpp @@ -41,7 +41,13 @@ perl_matcher::perl_matcher(BidiIter next_count(&rep_obj), rep_obj(&next_count) { typedef typename regex_iterator_traits::iterator_category category; - + + if(e.empty()) + { + // precondition failure: e is not a valid regex. + std::invalid_argument ex("Invalid regular expression object"); + boost::throw_exception(ex); + } pstate = 0; m_match_flags = f; icase = re.flags() & regex_constants::icase;