Skip to content

Commit

Permalink
fix crash when add property maybe failed on build arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
penneryu authored and saghul committed Nov 25, 2024
1 parent df44d66 commit 61dae5d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions quickjs.c
Original file line number Diff line number Diff line change
Expand Up @@ -13571,6 +13571,10 @@ static JSValue js_build_arguments(JSContext *ctx, int argc, JSValue *argv)
/* add the length field (cannot fail) */
pr = add_property(ctx, p, JS_ATOM_length,
JS_PROP_WRITABLE | JS_PROP_CONFIGURABLE);
if (!pr) {
JS_FreeValue(ctx, val);
return JS_EXCEPTION;
}
pr->u.value = js_int32(argc);

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

for(i = 0; i < arg_count; i++) {
Expand Down

0 comments on commit 61dae5d

Please sign in to comment.