From 9188464e39251ef9896c3bbfc2db152082af1410 Mon Sep 17 00:00:00 2001 From: John Maddock Date: Sat, 24 Oct 2009 15:51:57 +0000 Subject: [PATCH] Tighten up error handling and checking. [SVN r57133] --- include/boost/regex/v4/basic_regex_parser.hpp | 5 +++++ include/boost/regex/v4/match_results.hpp | 1 + 2 files changed, 6 insertions(+) diff --git a/include/boost/regex/v4/basic_regex_parser.hpp b/include/boost/regex/v4/basic_regex_parser.hpp index ebec35b6..0fa35786 100644 --- a/include/boost/regex/v4/basic_regex_parser.hpp +++ b/include/boost/regex/v4/basic_regex_parser.hpp @@ -141,6 +141,11 @@ void basic_regex_parser::parse(const charT* p1, const charT* p2, case regbase::literal: m_parser_proc = &basic_regex_parser::parse_literal; break; + default: + // Ooops, someone has managed to set more than one of the main option flags, + // so this must be an error: + fail(regex_constants::error_unknown, 0); + return; } // parse all our characters: diff --git a/include/boost/regex/v4/match_results.hpp b/include/boost/regex/v4/match_results.hpp index 09dd31f0..ce18c5c4 100644 --- a/include/boost/regex/v4/match_results.hpp +++ b/include/boost/regex/v4/match_results.hpp @@ -411,6 +411,7 @@ public: } void BOOST_REGEX_CALL set_first(BidiIterator i) { + BOOST_ASSERT(m_subs.size() > 2); // set up prefix: m_subs[1].second = i; m_subs[1].matched = (m_subs[1].first != i);