]> git.kaiwu.me - quickjs.git/commitdiff
fixed handling of 8 bit unicode strings in RegExp (regression introduced by commit...
authorFabrice Bellard <fabrice@bellard.org>
Mon, 25 Aug 2025 16:20:58 +0000 (18:20 +0200)
committerFabrice Bellard <fabrice@bellard.org>
Mon, 25 Aug 2025 16:20:58 +0000 (18:20 +0200)
libregexp.c

index 8ae4bac9a7a908c669ee0524ec326836101efc83..0cf9a1261d77adad1d94034b3d81d7ea6d5c5d73 100644 (file)
@@ -3190,7 +3190,7 @@ int lre_exec(uint8_t **capture,
     stack_buf = alloca(alloca_size);
 
     cptr = cbuf + (cindex << cbuf_type);
-    if (0 < cindex && cindex < clen && s->is_unicode) {
+    if (0 < cindex && cindex < clen && s->cbuf_type == 2) {
         const uint16_t *p = (const uint16_t *)cptr;
         if (is_lo_surrogate(*p) && is_hi_surrogate(p[-1])) {
             cptr = (const uint8_t *)(p - 1);