Commit 117744381ba for nodejs
commit 117744381bad95e5f6c19f796da71fa87571d6a6
Author: James M Snell <jasnell@gmail.com>
Date: Sun Nov 15 18:44:18 2026 +0000
module: add missing return in ImportMetaResolveLazyGetter
When the creation context of the import.meta object has no associated
Realm, the getter threw ERR_INVALID_INVOCATION but then fell through
and dereferenced the null Realm. Return after throwing, as the other
error paths in the getter already do.
Assisted-by: Claude
Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67496
Reviewed-By: Vladimir Morozov <vmorozov@microsoft.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
diff --git a/src/module_wrap.cc b/src/module_wrap.cc
index 96c83f37f57..8a122aeb65f 100644
--- a/src/module_wrap.cc
+++ b/src/module_wrap.cc
@@ -1261,6 +1261,7 @@ static void ImportMetaResolveLazyGetter(
Realm* realm = Realm::GetCurrent(context);
if (realm == nullptr) {
THROW_ERR_INVALID_INVOCATION(isolate);
+ return;
}
Local<Function> initializer = realm->host_import_meta_resolve_initializer();
if (initializer.IsEmpty()) {