Skip to content

Commit

Permalink
src: fix nullptr access on realm
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
jkrems committed Jul 16, 2023
1 parent a67cb6c commit ed04092
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/env.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit ed04092

Please sign in to comment.