Regex: Do not allow private use codepoints literals

We use them to encode non-literals in lookarounds, so they can
trigger bugs.

Fixes #1737
This commit is contained in:
Maxime Coste 2017-12-01 16:37:18 +08:00
parent 8d892eeb62
commit 7bfb695c45

View File

@ -292,7 +292,7 @@ private:
case '|': case ')': case '|': case ')':
return {}; return {};
default: default:
if (contains("^$.*+?[]{}", cp)) if (contains("^$.*+?[]{}", cp) or (cp >= 0xF0000 and cp <= 0xFFFFF))
parse_error(format("unexpected '{}'", cp)); parse_error(format("unexpected '{}'", cp));
++m_pos; ++m_pos;
return new_node(ParsedRegex::Literal, cp); return new_node(ParsedRegex::Literal, cp);