From d22810e476e23351b379b057540a565518c93f27 Mon Sep 17 00:00:00 2001 From: Tim Wojtulewicz Date: Mon, 21 Jul 2025 15:26:38 -0700 Subject: [PATCH] Add a few extra null checks, plus a missing initialization that led to a bad null check --- src/ID.cc | 3 +++ src/Stmt.cc | 6 +++--- src/Val.cc | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/ID.cc b/src/ID.cc index 7ebb744d6b..bd49d135bf 100644 --- a/src/ID.cc +++ b/src/ID.cc @@ -490,6 +490,9 @@ void ID::DescribeReST(ODesc* d, bool roles_only) const { ModuleName() != "Version" ) { d->Add(":Default:"); auto ii = zeekygen_mgr->GetIdentifierInfo(Name()); + if ( ! ii ) + return; + auto redefs = ii->GetRedefs(); const auto& iv = ! redefs.empty() && ii->InitialVal() ? ii->InitialVal() : val; diff --git a/src/Stmt.cc b/src/Stmt.cc index 071c025d89..78789a6e24 100644 --- a/src/Stmt.cc +++ b/src/Stmt.cc @@ -1734,10 +1734,10 @@ WhenInfo::WhenInfo(ExprPtr arg_cond, FuncType::CaptureList* arg_cl, bool arg_is_ } WhenInfo::WhenInfo(const WhenInfo* orig) { - if ( orig->cl ) { - cl = new FuncType::CaptureList; + cl = new FuncType::CaptureList; + + if ( orig->cl ) *cl = *orig->cl; - } cond = orig->OrigCond()->Duplicate(); diff --git a/src/Val.cc b/src/Val.cc index fe87c42aa0..13ff13c67e 100644 --- a/src/Val.cc +++ b/src/Val.cc @@ -2398,7 +2398,7 @@ ValPtr TableVal::Remove(const Val& index, bool broker_forward, bool* iterators_i if ( broker_forward && ! broker_store.empty() ) SendToStore(&index, nullptr, ELEMENT_REMOVED); - if ( change_func ) { + if ( change_func && k ) { // this is totally cheating around the fact that we need a Intrusive pointer. ValPtr changefunc_val = RecreateIndex(*(k.get())); CallChangeFunc(changefunc_val, va, ELEMENT_REMOVED);