Skip to content

fix: zero-initialize m_RefractiveIndex, out-of-bounds access guards - #61

Open
veprbl wants to merge 2 commits into
mainfrom
pr/zeroptr
Open

fix: zero-initialize m_RefractiveIndex, out-of-bounds access guards#61
veprbl wants to merge 2 commits into
mainfrom
pr/zeroptr

Conversation

@veprbl

@veprbl veprbl commented Jul 28, 2026

Copy link
Copy Markdown
Member

Bug 1

Garbage in the pointer leads to crashes in IrtInterface::~IrtInterface() when rindex_matrix is not available and rad->m_RefractiveIndex is not initialized.

https://github.com/eic/EICrecon/blob/e689e99d30cfd4c4e47ad10ab99ea828ae38db1b/src/algorithms/pid/IrtInterface.cc#L88-L100

https://github.com/eic/EICrecon/blob/e689e99d30cfd4c4e47ad10ab99ea828ae38db1b/src/algorithms/pid/IrtInterface.cc#L61-L62

Bug 2

The ibin >= _THETA_BIN_COUNT_ check is more of a defensive measure for hypothetical theta=pi case.
The check for m_AverageRefractiveIndices is needed to avoid hitting calibration region bound, and is practical in some events:

ProcessHits: no calibration for radiator 'Aerogel_PFRICH' theta-bin 30 (have 0 refractive indices, need 4); skipping hit

@veprbl veprbl changed the title fix: zero-initialize m_RefractiveIndex fix: zero-initialize m_RefractiveIndex, out-of-bounds access guards Jul 28, 2026
@veprbl
veprbl requested a review from alexander-kiselev July 29, 2026 00:41
@veprbl

veprbl commented Sep 4, 2026

Copy link
Copy Markdown
Member Author

@alexander-kiselev Any objections to this?

@veprbl
veprbl force-pushed the pr/zeroptr branch 2 times, most recently from 5ed749d to dd01eb1 Compare September 4, 2026 19:43
@alexander-kiselev

Copy link
Copy Markdown
Collaborator

Approved

@veprbl
veprbl enabled auto-merge (rebase) September 4, 2026 23:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants