From 2deef980fcae7c141f11ba8fd6cefd262fcb01d0 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Mon, 21 Sep 2026 13:53:45 +0200 Subject: [PATCH] Fix empty hwloc object dereference during TBBBind initialization (#2194) Some environments might use fsroot that does not provide CPU topology information. In such environments, hwloc_get_next_obj_by_type could return nullptr, and an unguarded invocation of hwloc_get_obj_with_same_locality would result in SIGSEGV. --- src/tbbbind/tbb_bind.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/tbbbind/tbb_bind.cpp b/src/tbbbind/tbb_bind.cpp index 26fa67474a..2adccea54e 100644 --- a/src/tbbbind/tbb_bind.cpp +++ b/src/tbbbind/tbb_bind.cpp @@ -268,7 +268,9 @@ class system_topology { // this function calls the interface that is available in the HWLOC 2.5 only. #if HWLOC_API_VERSION >= 0x20500 auto some_core = hwloc_get_next_obj_by_type(topology, HWLOC_OBJ_CORE, nullptr); - hwloc_get_obj_with_same_locality(topology, some_core, HWLOC_OBJ_CORE, nullptr, nullptr, 0); + if (some_core) { + hwloc_get_obj_with_same_locality(topology, some_core, HWLOC_OBJ_CORE, nullptr, nullptr, 0); + } #endif }