Skip to content

[io] Bound key and free-list reads - #23134

Open
laxmanacharya8 wants to merge 1 commit into
root-project:masterfrom
laxmanacharya8:io-bound-readkeys-readfree
Open

[io] Bound key and free-list reads#23134
laxmanacharya8 wants to merge 1 commit into
root-project:masterfrom
laxmanacharya8:io-bound-readkeys-readfree

Conversation

@laxmanacharya8

@laxmanacharya8 laxmanacharya8 commented Aug 22, 2026

Copy link
Copy Markdown

Summary

  • Use the size-aware TKey::ReadKeyBuffer overload in TDirectoryFile::ReadKeys and TFile::ReadFree. Recover already calls it; the normal open path did not.
  • Add TFree::ReadBuffer(char *&, std::size_t) and stop the free-list loop when the record is truncated, instead of looping until GetLast() > fEND.
  • Include the on-disk TDatime (UInt_t) in the key header size check.

This is leftover from #22190 / #22169: a keys record can still report a TString length 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/TFileReadKeysValid, ReadKeysOversizedString, ReadFreeValid, TFree.ReadBufferBounds
  • other local tests in that binary (web/xrootd cases skipped; those plugins were off in the local build)
  • GitHub CI io/io/test TFile gtest

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
laxmanacharya8 force-pushed the io-bound-readkeys-readfree branch from 43b8aea to a5df75b Compare August 22, 2026 18:57
@dpiparo dpiparo assigned dpiparo, pcanal and jblomer and unassigned dpiparo Aug 23, 2026
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.

4 participants