From a5b4e7c9755eca22b178a632fd4dd0e2c1c10b84 Mon Sep 17 00:00:00 2001 From: Archkon <180910180+Archkon@users.noreply.github.com> Date: Wed, 22 Jul 2026 12:46:06 +0800 Subject: [PATCH] src: require watchdog status pointers Remove the nullptr defaults from Watchdog and SigintWatchdog result parameters. Both watchdogs unconditionally dereference these pointers, so callers must explicitly provide valid status storage. Signed-off-by: Archkon <180910180+Archkon@users.noreply.github.com> --- src/node_watchdog.cc | 2 ++ src/node_watchdog.h | 7 ++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/node_watchdog.cc b/src/node_watchdog.cc index f9bfa0e0c86f..27c7d83c8a9d 100644 --- a/src/node_watchdog.cc +++ b/src/node_watchdog.cc @@ -41,6 +41,7 @@ using v8::Value; Watchdog::Watchdog(v8::Isolate* isolate, uint64_t ms, bool* timed_out) : isolate_(isolate), timed_out_(timed_out) { + CHECK_NOT_NULL(timed_out); int rc; rc = uv_loop_init(&loop_); @@ -103,6 +104,7 @@ void Watchdog::Timer(uv_timer_t* timer) { SigintWatchdog::SigintWatchdog( v8::Isolate* isolate, bool* received_signal) : isolate_(isolate), received_signal_(received_signal) { + CHECK_NOT_NULL(received_signal); Mutex::ScopedLock lock(SigintWatchdogHelper::GetInstanceActionMutex()); // Register this watchdog with the global SIGINT/Ctrl+C listener. SigintWatchdogHelper::GetInstance()->Register(this); diff --git a/src/node_watchdog.h b/src/node_watchdog.h index 096e347d7b3f..a4a31b3a3e9e 100644 --- a/src/node_watchdog.h +++ b/src/node_watchdog.h @@ -44,9 +44,7 @@ enum class SignalPropagation { class Watchdog { public: - explicit Watchdog(v8::Isolate* isolate, - uint64_t ms, - bool* timed_out = nullptr); + explicit Watchdog(v8::Isolate* isolate, uint64_t ms, bool* timed_out); ~Watchdog(); v8::Isolate* isolate() { return isolate_; } @@ -75,8 +73,7 @@ class SigintWatchdogBase { class SigintWatchdog : public SigintWatchdogBase { public: - explicit SigintWatchdog(v8::Isolate* isolate, - bool* received_signal = nullptr); + explicit SigintWatchdog(v8::Isolate* isolate, bool* received_signal); ~SigintWatchdog(); v8::Isolate* isolate() { return isolate_; } SignalPropagation HandleSigint() override;