Skip to content

Commit 409cc69

Browse files
jkremsRafaelGSS
authored andcommitted
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: #48802 Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: Mohammed Keyvanzadeh <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
1 parent 388c7d9 commit 409cc69

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/env.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ void Environment::AssignToContext(Local<v8::Context> context,
575575
// Used to retrieve bindings
576576
context->SetAlignedPointerInEmbedderData(
577577
ContextEmbedderIndex::kBindingDataStoreIndex,
578-
realm->binding_data_store());
578+
realm != nullptr ? realm->binding_data_store() : nullptr);
579579

580580
// ContextifyContexts will update this to a pointer to the native object.
581581
context->SetAlignedPointerInEmbedderData(

0 commit comments

Comments
 (0)