Skip to content

[tree] In TBasket/TBranch, error out if reading oob in the streamer#22165

Open
silverweed wants to merge 2 commits intoroot-project:masterfrom
silverweed:tbasket_read_oob
Open

[tree] In TBasket/TBranch, error out if reading oob in the streamer#22165
silverweed wants to merge 2 commits intoroot-project:masterfrom
silverweed:tbasket_read_oob

Conversation

@silverweed
Copy link
Copy Markdown
Contributor

@silverweed silverweed commented May 6, 2026

TODO

  • add tests
  • verify if we can just ignore fNevBufSize and pass nullptr to ReadArray or if we should rather check that they match

Checklist:

  • tested changes locally
  • updated the docs (if necessary)

This PR fixes #22164

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

Test Results

    22 files      22 suites   3d 9h 30m 52s ⏱️
 3 851 tests  3 851 ✅ 0 💤 0 ❌
76 052 runs  76 052 ✅ 0 💤 0 ❌

Results for commit bf379ae.

♻️ This comment has been updated with latest results.

@silverweed silverweed marked this pull request as ready for review May 7, 2026 11:40
Comment thread tree/tree/src/TBranch.cxx
fBasketEntry = new Long64_t[fMaxBaskets];
b >> n;
if (n > fMaxBaskets) {
Error("Streamer", "Inconsistent length of the entry buffer. Refusing to deserialize.");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
Error("Streamer", "Inconsistent length of the entry buffer. Refusing to deserialize.");
Error("Streamer", "Inconsistent number of baskets. Refusing to deserialize. Read %d for an expected maximum of %d.", n, fMaxBaskets);

Comment thread tree/tree/src/TBasket.cxx
}
if (!mustGenerateOffsets && flag && (flag % 10 != 2)) {
if (fNevBuf > fNevBufSize) {
Error("Streamer", "Inconsistent length of the entry buffer. Refusing to deserialize.");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could we make the message more explicit?

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.

[tree] Heap buffer overflow in TBasket::Streamer when reading TTree baskets with mismatched fNevBufSize and on-disk array length

2 participants