]> git.kaiwu.me - quickjs.git/commitdiff
don't append in place to strings that are atoms (bnoordhuis)
authorFabrice Bellard <fabrice@bellard.org>
Sat, 21 Nov 2026 12:22:40 +0000 (13:22 +0100)
committerFabrice Bellard <fabrice@bellard.org>
Sat, 21 Nov 2026 12:22:40 +0000 (13:22 +0100)
quickjs.c

index 4b9ba1b33ab6b148f39e704c91dd40b93ab95cb3..55ffcbc7453e5d821b3504cf4d34f69a83c283bf 100644 (file)
--- a/quickjs.c
+++ b/quickjs.c
@@ -4793,7 +4793,7 @@ static BOOL JS_ConcatStringInPlace(JSContext *ctx, JSString *p1, JSValueConst op
 
         if (p2->len == 0)
             return TRUE;
-        if (js_rc(p1)->ref_count != 1)
+        if (js_rc(p1)->ref_count != 1 || p1->atom_type != 0)
             return FALSE;
         size1 = js_malloc_usable_size(ctx, p1);
         if (p1->is_wide_char) {