From 2e7e73aecf2e72ed4f77fe0afc0a7d8e1ccc199f Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Wed, 22 Feb 2017 12:52:53 +0000 Subject: [PATCH] de-fuzz: Prevent excessive left shifts --- include/boost/regex/v4/basic_regex_parser.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/regex/v4/basic_regex_parser.hpp b/include/boost/regex/v4/basic_regex_parser.hpp index 31153698..780c37fe 100644 --- a/include/boost/regex/v4/basic_regex_parser.hpp +++ b/include/boost/regex/v4/basic_regex_parser.hpp @@ -902,7 +902,7 @@ escape_type_class_jump: } if(negative) i = 1 + m_mark_count - i; - if(((i > 0) && (i < std::numeric_limits::digits) && (this->m_backrefs & (1u << (i-1)))) || ((i > 10000) && (this->m_pdata->get_id(i) > 0) && (this->m_backrefs & (1u << (this->m_pdata->get_id(i)-1))))) + if(((i > 0) && (i < std::numeric_limits::digits) && (i - 1 < sizeof(unsigned) * CHAR_BIT) && (this->m_backrefs & (1u << (i-1)))) || ((i > 10000) && (this->m_pdata->get_id(i) > 0) && (this->m_pdata->get_id(i)-1 < sizeof(unsigned) * CHAR_BIT) && (this->m_backrefs & (1u << (this->m_pdata->get_id(i)-1))))) { m_position = pc; re_brace* pb = static_cast(this->append_state(syntax_element_backref, sizeof(re_brace)));