forked from boostorg/regex
Add checks for invalid UTF-8 sequences, see: https://svn.boost.org/trac/boost/ticket/9473
This commit is contained in:
@ -629,9 +629,15 @@ private:
|
||||
0x1FFFFFu,
|
||||
};
|
||||
m_value &= masks[extra];
|
||||
// check the result:
|
||||
// check the result is in range:
|
||||
if(m_value > static_cast<U32Type>(0x10FFFFu))
|
||||
invalid_sequence();
|
||||
// The result must not be a surrogate:
|
||||
if((m_value >= static_cast<U32Type>(0xD800)) && (m_value <= static_cast<U32Type>(0xDFFF)))
|
||||
invalid_sequence();
|
||||
// We should not have had an invalidly encoded UTF8 sequence:
|
||||
if((extra > 0) && (m_value <= static_cast<U32Type>(masks[extra - 1])))
|
||||
invalid_sequence();
|
||||
}
|
||||
BaseIterator m_position;
|
||||
mutable U32Type m_value;
|
||||
|
Reference in New Issue
Block a user