Skip to content

Commit 563e61f

Browse files
Eusgormarco-ippolito
authored andcommitted
src: fix possible dereference of null pointer
There is a CHECK_NOT_NULL check before dereferencing node_env on line 710 in the "if" block, but there is no CHECK_NOT_NULL check before dereferencing node_env on line 721. Maybe it makes sense to put CHECK_NOT_NULL right after calling the Environment::GetCurrent function. PR-URL: #58459 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
1 parent cbec07e commit 563e61f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/node_api.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -693,9 +693,9 @@ void napi_module_register_by_symbol(v8::Local<v8::Object> exports,
693693
napi_addon_register_func init,
694694
int32_t module_api_version) {
695695
node::Environment* node_env = node::Environment::GetCurrent(context);
696+
CHECK_NOT_NULL(node_env);
696697
std::string module_filename = "";
697698
if (init == nullptr) {
698-
CHECK_NOT_NULL(node_env);
699699
node_env->ThrowError("Module has no declared entry point.");
700700
return;
701701
}

0 commit comments

Comments
 (0)