Skip to content

Commit

Permalink
Fix: 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 committed Nov 25, 2024
1 parent 97c34d9 commit 5c33cb9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions bridge/third_party/quickjs/src/core/builtins/js-function.c
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,10 @@ JSValue js_build_arguments(JSContext* ctx, int argc, JSValueConst* 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_NewInt32(ctx, argc);

/* initialize the fast array part */
Expand Down Expand Up @@ -545,6 +549,8 @@ JSValue js_build_mapped_arguments(JSContext* ctx,

/* 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_NewInt32(ctx, argc);

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

0 comments on commit 5c33cb9

Please sign in to comment.