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`.

PR-URL: #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>
  • Loading branch information
jkrems authored and targos committed Nov 26, 2023
1 parent 629132d commit f5384c3
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 @@ -547,7 +547,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 f5384c3

Please sign in to comment.