From 95f005f4fa23ba63b87f16844e59c880dcddc2df Mon Sep 17 00:00:00 2001 From: Eswara Valli Date: Wed, 11 Nov 2026 00:16:42 +0530 Subject: [PATCH] XUtils: add NULL pointer guard in String_contains_i On Darwin/macOS and Linux, Process_getCommand() can legitimately return NULL for certain processes or threads. When an incremental filter is active, this NULL pointer can reach String_contains_i(), which previously passed it to strcasestr() and caused a segmentation fault. Add an early NULL guard to prevent the crash. Verified with external regression harnesses covering NULL inputs and normal single- and multi-needle matching. Fixes: #1864 Assisted-by: Antigravity (Google DeepMind) Signed-off-by: Eswara Valli --- XUtils.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/XUtils.c b/XUtils.c index 9e2d6bf1a9..1eed7772fd 100644 --- a/XUtils.c +++ b/XUtils.c @@ -107,6 +107,9 @@ void* xReallocArrayZero(void* ptr, size_t prevmemb, size_t newmemb, size_t size) } inline bool String_contains_i(const char* s1, const char* s2, bool multi) { + if (!s1 || !s2) + return false; + // we have a multi-string search term, handle as special case for performance reasons if (multi && strchr(s2, '|')) { size_t nNeedles;