]> git.kaiwu.me - quickjs.git/commitdiff
Fix sloppy mode arguments uninitialized value use
authorBen Noordhuis <info@bnoordhuis.nl>
Wed, 1 Nov 2023 03:24:42 +0000 (04:24 +0100)
committerBen Noordhuis <info@bnoordhuis.nl>
Sun, 11 Feb 2024 22:54:19 +0000 (23:54 +0100)
MemorySanitizer complained about uninitialized reads in
the indexed property code path in JS_GetPropertyValue()
with JS_CLASS_MAPPED_ARGUMENTS objects.

quickjs.c

index 3e9f4b37df33cfc4b3295e896070d4497e3808c7..1e8261579ffec37ad0a4c55605e1b1036939fd61 100644 (file)
--- a/quickjs.c
+++ b/quickjs.c
@@ -14774,6 +14774,8 @@ static JSValue js_build_mapped_arguments(JSContext *ctx, int argc,
     if (JS_IsException(val))
         return val;
     p = JS_VALUE_GET_OBJ(val);
+    p->u.array.u.values = NULL;
+    p->u.array.count = 0;
 
     /* add the length field (cannot fail) */
     pr = add_property(ctx, p, JS_ATOM_length,