Skip to content

[ntuple] Support strings longer than 254 chars in RMiniFile - #24152

Open
kr1xh wants to merge 1 commit into
root-project:masterfrom
kr1xh:fix/rminifile-long-strings
Open

kr1xh wants to merge 1 commit into
root-project:masterfrom
kr1xh:fix/rminifile-long-strings

Conversation

@kr1xh

@kr1xh kr1xh commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

This Pull request:

Lets RMiniFile read and write TFile strings with 255 or more characters. Until now RTFString only implemented the one byte length form, so a long RNTuple name, or a file written by TFile with a long title or key name, hit an R__ASSERT.

Changes or fixes:

  • RTFString now owns its serialized bytes. Strings longer than 254 characters use the long form of TBufferFile::WriteTString: the byte 255, then the length as a 32-bit big-endian integer.
  • A new ReadTFString() helper reads both forms. It is used in SearchInDirectory(), GetNTupleProper() and GetNTupleBare().
  • RTFKey throws an RException when a key header does not fit the signed 16-bit key length of TKey.
  • New tests in ntuple_minifile: a TFile title of 255, 256 and 2000 characters, a 300 character RNTuple name in the bare, simple TFile and proper TFile containers, and a key header that is too long.

One open question: the reader trusts the long-form length it reads, so a corrupt file can request a large allocation. Should it be bounded? Strings inside a key are limited by the key length, but the name in a bare file is not.

This Description was written with AI assistance (Claude Code, claude-opus-5-5).

Checklist:

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

This PR fixes #14460

RMiniFile writes and reads the class name, object name and title of
TFile keys as TString, but it only implemented the short form with a
one byte length. A string of 255 or more characters, e.g. a long
RNTuple name or a long title of a TFile, aborted on an R__ASSERT.

Implement the long form as TBufferFile::WriteTString does: the byte
255 followed by the length as a 32-bit big-endian integer. RTFString
now owns its serialized bytes, and a new helper reads both forms. A
key header that does not fit the 16-bit TKey key length now throws.

Fixes root-project#14460

Assisted-by: claude-code:claude-opus-5-5

This branch has not been deployed

No deployments
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.

RMiniFile cannot read files with long paths

1 participant