File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -535,7 +535,8 @@ void ContextifyContext::PropertySetterCallback(
535535 if (is_declared_on_sandbox &&
536536 ctx->sandbox ()
537537 ->GetOwnPropertyDescriptor (context, property)
538- .ToLocal (&desc)) {
538+ .ToLocal (&desc) &&
539+ !desc->IsUndefined ()) {
539540 Environment* env = Environment::GetCurrent (context);
540541 Local<Object> desc_obj = desc.As <Object>();
541542
Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+ require ( '../common' ) ;
3+
4+ // Setting __proto__ on vm context's globalThis should not cause a crash
5+ // Regression test for https://github.com/nodejs/node/issues/47798
6+
7+ const vm = require ( 'vm' ) ;
8+ const context = vm . createContext ( ) ;
9+
10+ const contextGlobalThis = vm . runInContext ( 'this' , context ) ;
11+
12+ // Should not crash.
13+ contextGlobalThis . __proto__ = null ; // eslint-disable-line no-proto
You can’t perform that action at this time.
0 commit comments