Skip to content

TObject: fUniqueID is read signed and unmasked; pidf is never combined with fPidOffset or resolved to a ProcessID record #110

Description

@nsmith-

🤖 AI generated content

src/rootfilespec/bootstrap/TObject.py:89 unpacks ">hii", so fUniqueID (declared Fmt(">i") at :74) and fBits are signed Int_t. pidf (:78-83, read at :92-93) is stored raw and never used.

Spec:

  • References §5 "What fUniqueID means": fUniqueID is a UInt_t whose top byte is either zeroed (a referenced object) or a stale session index (a TRef), with 0xFF as an escape. A reader should take the serial as fUniqueID & 0x00FFFFFF and "never compare two fUniqueID words directly". Read signed, any surviving top byte ≥ 0x80 yields a negative number.
  • References §2 "pidf and the TProcessID records": the process id is pidf plus the record's key fPidOffset, and names a top-level key ProcessID<n>. The pidf docstring omits fPidOffset, which the spec's errata note is undocumented upstream too.

Evidence: by reading the code against the spec; no test file with a non-zero top byte or non-zero fPidOffset was identified, so not reproduced on data.

Suggested fix: read fUniqueID and fBits as >I; expose the 24-bit serial (property or documented mask); carry the enclosing key's fPidOffset in the buffer context so pidf + fPidOffset can be formed — this depends on #88, which currently does not even separate fPidOffset from fSeekPdir. Mapping to ProcessID<n> keys belongs with TRef/TRefArray in #101.

Severity / size: medium (wrong values only for referenced objects / TRef users) / S for signedness, M for resolution.

Related: #88, #101, #93 (the same trailing pidf for element code 15), #109.

Assisted-by: claude-code:claude-fable-5-1

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions