Skip to content

Commit 01c2a67

Browse files
indutnytjfontaine
authored andcommitted
contexify: fix infinite recursion in delete cb
Do not ever call `Delete()` on `proxy_global_`, it will invoke `GlobalPropertyDeleteCallback` and cause crash because of the infinite recursion. fix #7529
1 parent e7bfbaf commit 01c2a67

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

‎src/node_contextify.cc‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -414,10 +414,6 @@ class ContextifyContext {
414414

415415
bool success = PersistentToLocal(isolate,
416416
ctx->sandbox_)->Delete(property);
417-
if (!success) {
418-
success = PersistentToLocal(isolate,
419-
ctx->proxy_global_)->Delete(property);
420-
}
421417
args.GetReturnValue().Set(success);
422418
}
423419

‎test/simple/test-vm-context.js‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,10 @@ script = vm.createScript('var assert = require(\'assert\'); assert.throws(' +
7373
'function() { throw "hello world"; }, /hello/);',
7474
'some.js');
7575
script.runInNewContext({ require : require });
76+
77+
// Issue GH-7529
78+
script = vm.createScript('delete b');
79+
var ctx = {};
80+
Object.defineProperty(ctx, 'b', { configurable: false });
81+
ctx = vm.createContext(ctx);
82+
assert.equal(script.runInContext(ctx), false);

0 commit comments

Comments
 (0)