From bea98e65a70cfd23e32869c71401c2ef487d5d1b Mon Sep 17 00:00:00 2001 From: Felix Weiglhofer Date: Fri, 20 Jun 2025 16:28:14 +0200 Subject: [PATCH] GPU/TPCClusterFinder: Fix out-of-bounds write. --- .../TPCClusterFinder/GPUTPCCFStreamCompaction.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/GPU/GPUTracking/TPCClusterFinder/GPUTPCCFStreamCompaction.cxx b/GPU/GPUTracking/TPCClusterFinder/GPUTPCCFStreamCompaction.cxx index d43e96b19c5d0..0f2fd235dc0d0 100644 --- a/GPU/GPUTracking/TPCClusterFinder/GPUTPCCFStreamCompaction.cxx +++ b/GPU/GPUTracking/TPCClusterFinder/GPUTPCCFStreamCompaction.cxx @@ -55,8 +55,9 @@ GPUdii() void GPUTPCCFStreamCompaction::Thread int32_t iThreadGlobal = get_global_id(0); int32_t offsetInBlock = work_group_scan_inclusive_add((iThreadGlobal < nElems) ? scanOffset[iThreadGlobal] : 0); - // TODO: This write isn't needed?? - scanOffset[iThreadGlobal] = offsetInBlock; + if (iThreadGlobal < nElems) { + scanOffset[iThreadGlobal] = offsetInBlock; + } int32_t lastThread = nThreads - 1; if (iThread == lastThread) {