Skip to content

Conversation

@silverweed
Copy link
Contributor

Corrupted files may cause ReadBuffer to fail, so the proper way of handling it is by returning a RResult rather than asserting.
In the interest of not changing the many places using ReadBuffer, I made it wrap a TryReadBuffer function that returns RResult and simply call ThrowOnError on it.
This gives similar semantics as before, except ReadBuffer will throw rather than asserting.

@silverweed silverweed requested review from enirolf and hahnjo January 22, 2026 13:18
@silverweed silverweed self-assigned this Jan 22, 2026
@silverweed silverweed requested a review from jblomer as a code owner January 22, 2026 13:18
// Read first chunk
nread = fRawFile->ReadAt(bufCur, fMaxKeySize, offset);
R__ASSERT(nread == fMaxKeySize);
if (R__unlikely(nread != fMaxKeySize))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should use R__(un)likley only on performance critical paths.

Suggested change
if (R__unlikely(nread != fMaxKeySize))
if (nread != fMaxKeySize)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used it as a "safe default" since it's also there in R__ASSERT, but it's probably not really impactful in this case.

@github-actions
Copy link

Test Results

    21 files      21 suites   3d 11h 28m 36s ⏱️
 3 766 tests  3 766 ✅ 0 💤 0 ❌
71 488 runs  71 488 ✅ 0 💤 0 ❌

Results for commit e742851.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants