From 7bfb695c454b6d5ce0bd40e37cc8a57d264c7ce2 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Fri, 1 Dec 2017 16:37:18 +0800 Subject: [PATCH] Regex: Do not allow private use codepoints literals We use them to encode non-literals in lookarounds, so they can trigger bugs. Fixes #1737 --- src/regex_impl.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/regex_impl.cc b/src/regex_impl.cc index 19516f63..91d1816a 100644 --- a/src/regex_impl.cc +++ b/src/regex_impl.cc @@ -292,7 +292,7 @@ private: case '|': case ')': return {}; default: - if (contains("^$.*+?[]{}", cp)) + if (contains("^$.*+?[]{}", cp) or (cp >= 0xF0000 and cp <= 0xFFFFF)) parse_error(format("unexpected '{}'", cp)); ++m_pos; return new_node(ParsedRegex::Literal, cp);