From: Fabrice Bellard Date: Tue, 24 Nov 2026 17:06:22 +0000 (+0100) Subject: Fix rejection of escaped reserved punctuators in v-flag \q (Samir) X-Git-Url: https://git.kaiwu.me/http/%22..//%22?a=commitdiff_plain;h=55436afefb4206b8094a6e49d5f8ea2c8acdf51f;p=quickjs.git Fix rejection of escaped reserved punctuators in v-flag \q (Samir) --- diff --git a/libregexp.c b/libregexp.c index b231e95..a66c622 100644 --- a/libregexp.c +++ b/libregexp.c @@ -1008,7 +1008,7 @@ static int parse_class_string_disjunction(REParseState *s, REStringList *cr, for(;;) { str.size = 0; while (*p != '}' && *p != '|') { - c = get_class_atom(s, NULL, &p, FALSE); + c = get_class_atom(s, NULL, &p, TRUE); if (c < 0) goto fail; if (dbuf_put_u32(&str, c)) { @@ -1102,6 +1102,23 @@ static int get_class_atom(REParseState *s, REStringList *cr, if (!inclass && s->is_unicode) goto invalid_escape; break; + case '&': + case '!': + case '#': + case '%': + case ',': + case ':': + case ';': + case '<': + case '=': + case '>': + case '@': + case '`': + case '~': + if (s->is_unicode && (!inclass || !s->unicode_sets)) + /* Only illegal if in unicode mode and not in a class */ + goto invalid_escape; + break; case '^': case '$': case '\\':