Skip to content

Commit 4bba87d

Browse files
committed
Fix potentially stale tv_key in deleteProperty
1 parent 233d9b6 commit 4bba87d

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src-input/duk_hobject_props.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4430,10 +4430,10 @@ DUK_INTERNAL duk_bool_t duk_hobject_delprop(duk_hthread *thr, duk_tval *tv_obj,
44304430
/* Note: proxy handling must happen before key is string coerced. */
44314431

44324432
if (duk__proxy_check_prop(thr, obj, DUK_STRIDX_DELETE_PROPERTY, tv_key, &h_target)) {
4433-
/* -> [ ... trap handler ] */
4433+
/* -> [ ... obj key trap handler ] */
44344434
DUK_DDD(DUK_DDDPRINT("-> proxy object 'deleteProperty' for key %!T", (duk_tval *) tv_key));
44354435
duk_push_hobject(ctx, h_target); /* target */
4436-
duk_push_tval(ctx, tv_key); /* P */
4436+
duk_dup_m4(ctx); /* P */
44374437
duk_call_method(ctx, 2 /*nargs*/);
44384438
tmp_bool = duk_to_boolean(ctx, -1);
44394439
duk_pop(ctx);
@@ -4444,6 +4444,7 @@ DUK_INTERNAL duk_bool_t duk_hobject_delprop(duk_hthread *thr, duk_tval *tv_obj,
44444444
/* Target object must be checked for a conflicting
44454445
* non-configurable property.
44464446
*/
4447+
tv_key = DUK_GET_TVAL_NEGIDX(ctx, -1);
44474448
arr_idx = duk__push_tval_to_property_key(ctx, tv_key, &key);
44484449
DUK_ASSERT(key != NULL);
44494450

0 commit comments

Comments
 (0)