Skip to content

Commit 61dae5d

Browse files
penneryusaghul
authored andcommitted
fix crash when add property maybe failed on build arguments
1 parent df44d66 commit 61dae5d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

quickjs.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13571,6 +13571,10 @@ static JSValue js_build_arguments(JSContext *ctx, int argc, JSValue *argv)
1357113571
/* add the length field (cannot fail) */
1357213572
pr = add_property(ctx, p, JS_ATOM_length,
1357313573
JS_PROP_WRITABLE | JS_PROP_CONFIGURABLE);
13574+
if (!pr) {
13575+
JS_FreeValue(ctx, val);
13576+
return JS_EXCEPTION;
13577+
}
1357413578
pr->u.value = js_int32(argc);
1357513579

1357613580
/* initialize the fast array part */
@@ -13620,6 +13624,8 @@ static JSValue js_build_mapped_arguments(JSContext *ctx, int argc,
1362013624
/* add the length field (cannot fail) */
1362113625
pr = add_property(ctx, p, JS_ATOM_length,
1362213626
JS_PROP_WRITABLE | JS_PROP_CONFIGURABLE);
13627+
if (!pr)
13628+
goto fail;
1362313629
pr->u.value = js_int32(argc);
1362413630

1362513631
for(i = 0; i < arg_count; i++) {

0 commit comments

Comments
 (0)