mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
src: fix nullptr access on realm
Adding the per-realm binding data tracking introduced a call to a realm method when realm was potentially null. This is triggered whenever the function is called from `ContextifyContext::New` which passes `nullptr` as the `realm`. PR-URL: https://github.com/nodejs/node/pull/48802 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
This commit is contained in:
1 parent
388c7d9232
commit
409cc692db
1 file changed
+1
-1
+1
-1
@@ -575,7 +575,7 @@ void Environment::AssignToContext(Local<v8::Context> context,
|
||||
// Used to retrieve bindings
|
||||
context->SetAlignedPointerInEmbedderData(
|
||||
ContextEmbedderIndex::kBindingDataStoreIndex,
|
||||
realm->binding_data_store());
|
||||
realm != nullptr ? realm->binding_data_store() : nullptr);
|
||||
|
||||
// ContextifyContexts will update this to a pointer to the native object.
|
||||
context->SetAlignedPointerInEmbedderData(
|
||||
|
||||
Reference in new issue
Block a user