From 67e78287580a547ad17645f5cd79549290c0e24b Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Fri, 28 Jul 2023 16:14:33 -0400 Subject: [PATCH 1/2] report: fix recent coverity warning Fix warning about dereferencing null env Signed-off-by: Michael Dawson --- src/node_report.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/node_report.cc b/src/node_report.cc index dcaa6922070b92..3cf37b44d1b27f 100644 --- a/src/node_report.cc +++ b/src/node_report.cc @@ -857,9 +857,11 @@ std::string TriggerNodeReport(Isolate* isolate, // Determine the required report filename. In order of priority: // 1) supplied on API 2) configured on startup 3) default generated if (!name.empty()) { - THROW_IF_INSUFFICIENT_PERMISSIONS( - env, permission::PermissionScope::kFileSystemWrite, name, name); - // Filename was specified as API parameter. + if (env != nullptr) { + THROW_IF_INSUFFICIENT_PERMISSIONS( + env, permission::PermissionScope::kFileSystemWrite, name, name); + // Filename was specified as API parameter. + } filename = name; } else { std::string report_filename; From 2b1c6839b95da497355c755ed1dc29a4640a8bd3 Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Thu, 3 Aug 2023 09:18:41 -0400 Subject: [PATCH 2/2] Update src/node_report.cc --- src/node_report.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/node_report.cc b/src/node_report.cc index 3cf37b44d1b27f..31d857560e00be 100644 --- a/src/node_report.cc +++ b/src/node_report.cc @@ -857,6 +857,8 @@ std::string TriggerNodeReport(Isolate* isolate, // Determine the required report filename. In order of priority: // 1) supplied on API 2) configured on startup 3) default generated if (!name.empty()) { + // we may not always be in a great state when generating a node report + // allow for the case where we don't have an env if (env != nullptr) { THROW_IF_INSUFFICIENT_PERMISSIONS( env, permission::PermissionScope::kFileSystemWrite, name, name);