]> git.kaiwu.me - quickjs.git/commitdiff
regexp: allow [\-] in unicode mode (#373)
authorFabrice Bellard <fabrice@bellard.org>
Thu, 13 Mar 2025 18:00:25 +0000 (19:00 +0100)
committerFabrice Bellard <fabrice@bellard.org>
Thu, 13 Mar 2025 18:00:25 +0000 (19:00 +0100)
libregexp.c

index 9295fe72f6b700d28bb6372340ab04008a46a52a..8c473898526a9d8f0fd66d22180f00ddeae5c4ca 100644 (file)
@@ -686,6 +686,10 @@ static int get_class_atom(REParseState *s, CharRange *cr,
                 c = '\\';
             }
             break;
+        case '-':
+            if (!inclass && s->is_unicode)
+                goto invalid_escape;
+            break;
 #ifdef CONFIG_ALL_UNICODE
         case 'p':
         case 'P':