Browse Source

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
archived-io.js-v0.10
Fedor Indutny 11 years ago
committed by Timothy J Fontaine
parent
commit
01c2a670a1
  1. 4
      src/node_contextify.cc
  2. 7
      test/simple/test-vm-context.js

4
src/node_contextify.cc

@ -414,10 +414,6 @@ class ContextifyContext {
bool success = PersistentToLocal(isolate, bool success = PersistentToLocal(isolate,
ctx->sandbox_)->Delete(property); ctx->sandbox_)->Delete(property);
if (!success) {
success = PersistentToLocal(isolate,
ctx->proxy_global_)->Delete(property);
}
args.GetReturnValue().Set(success); args.GetReturnValue().Set(success);
} }

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

@ -73,3 +73,10 @@ script = vm.createScript('var assert = require(\'assert\'); assert.throws(' +
'function() { throw "hello world"; }, /hello/);', 'function() { throw "hello world"; }, /hello/);',
'some.js'); 'some.js');
script.runInNewContext({ require : require }); script.runInNewContext({ require : require });
// Issue GH-7529
script = vm.createScript('delete b');
var ctx = {};
Object.defineProperty(ctx, 'b', { configurable: false });
ctx = vm.createContext(ctx);
assert.equal(script.runInContext(ctx), false);

Loading…
Cancel
Save