[io] Bound key and free-list reads - #23134
Open
laxmanacharya8 wants to merge 1 commit into
Open
Conversation
laxmanacharya8
force-pushed
the
io-bound-readkeys-readfree
branch
from
August 22, 2026 18:37
b6159c2 to
43b8aea
Compare
ReadKeys and ReadFree still used the unbounded ReadKeyBuffer overload. A keys record can lie about TString lengths and walk off the heap buffer. ReadFree also had no remaining-size check, so a truncated free list never hit GetLast() > fEND.
laxmanacharya8
force-pushed
the
io-bound-readkeys-readfree
branch
from
August 22, 2026 18:57
43b8aea to
a5df75b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TKey::ReadKeyBufferoverload inTDirectoryFile::ReadKeysandTFile::ReadFree. Recover already calls it; the normal open path did not.TFree::ReadBuffer(char *&, std::size_t)and stop the free-list loop when the record is truncated, instead of looping untilGetLast() > fEND.TDatime(UInt_t) in the key header size check.This is leftover from #22190 / #22169: a keys record can still report a
TStringlength far larger than the buffer.AI-assisted disclosure: Cursor/LLM assistance was used during analysis and implementation. I have personally reviewed, tested, and understand the changes and take full responsibility for them.
Test plan
io/io/test/TFile—ReadKeysValid,ReadKeysOversizedString,ReadFreeValid,TFree.ReadBufferBoundsio/io/testTFile gtest