Skip to content

Fix out-of-range hit access in the TOF hit merging - #15747

Merged
sawenzel merged 1 commit into
AliceO2Group:devfrom
sawenzel:fix-tof-hit-merge-empty
Sep 2, 2026
Merged

Fix out-of-range hit access in the TOF hit merging#15747
sawenzel merged 1 commit into
AliceO2Group:devfrom
sawenzel:fix-tof-hit-merge-empty

Conversation

@sawenzel

@sawenzel sawenzel commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

This fixes a crash in TOF ProcessHits when the first step of an event cannot be assigned to a pad.

  • Geo::getIndex returns -1 when the position does not resolve to a valid sector/plate/strip.
  • mLastChannelID is -1 at the start of every event, so channel == mLastChannelID holds, the || does not short-circuit, and mHits->back() is called on an empty vector, giving "free(): invalid pointer".
  • The merging condition now requires a non-empty hit vector and a valid channel, so an off-pad step always starts a new hit.

This fixes a crash in TOF ProcessHits when the first step of an event
cannot be assigned to a pad.

- Geo::getIndex returns -1 when the position does not resolve to a valid
  sector/plate/strip.
- mLastChannelID is -1 at the start of every event, so channel ==
  mLastChannelID holds, the || does not short-circuit, and mHits->back()
  is called on an empty vector, giving "free(): invalid pointer".
- The merging condition now requires a non-empty hit vector and a valid
  channel, so an off-pad step always starts a new hit.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@sawenzel
sawenzel requested a review from noferini as a code owner September 1, 2026 14:49
@sawenzel
sawenzel merged commit d80c5cb into AliceO2Group:dev Sep 2, 2026
10 of 11 checks passed
@sawenzel
sawenzel deleted the fix-tof-hit-merge-empty branch September 2, 2026 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants