Repository navigation
fix(iso9660): read a directory record's data length from its little-endian half - #14801
Conversation
Split the half reading out of readBothEndian, and name the failure it raises, so a caller can keep a disagreeing big-endian copy or raise the same failure itself. The agreement check and its failure are unchanged.
…ndian half One directory record whose big-endian data_length copy differed from its little-endian half refused the whole image as malformed, wherever the record sat in the tree, so no member was inventoried. Linux isofs, libarchive and pycdlib read only the little-endian half of a record's data length, because mastering programs have written images whose big-endian copy is wrong. Records inside directory extents now use the little-endian half and keep a disagreeing copy, which the entry reports as a limitation with both values. A descriptor's own root record still requires both halves to agree, as libarchive does, and every other both-endian field keeps its agreement check. The boundary case that pinned the refusal now lists the file or the directory by its little-endian length and reads the rest of the tree.
…halves A primary or Joliet descriptor whose root record stores a big-endian data length copy that differs from its little-endian half stays malformed at that field, so the little-endian reading of records inside directory extents does not reach the descriptors.
[Medium impact] The PR appears safe to merge; no actionable issue was found. SummaryThe PR reads directory-record lengths from their little-endian half while preserving disagreements as warnings. Descriptor root records remain strict.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Read directory record] --> B{Descriptor root?}
B -->|Yes| C[Require matching length halves]
B -->|No| D[Use little-endian length]
D --> E{Halves disagree?}
E -->|Yes| F{Opening . or .. record?}
F -->|Yes| G[Keep container warning]
F -->|No| H[Keep entry warning]
E -->|No| I[Continue existing checks]
G --> I
H --> I
I --> J[Check links, bounds, and budgets]
Reviews (7) · Last reviewed commit: "fix(iso): retain directory-link length d..." · Reviewed by Greptile |
Damage the big-endian data length copy of both sections of a contiguous multi-extent file followed by a clean file. The file keeps its summed little-endian size and verified hash, and its entry names both records with their own values, in section order. The next file carries no disagreement, so the per-member list is neither lost between sections nor carried into the following member.
The formatter prints the three-group chain in the multi-extent case, rows.get(path)?.limitations.filter(...), one member per line when it does not fit on one line. The previous commit kept it on one line, which failed format:check.
…ittle-endian-data-length
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
related: #15020 has landed. it relaxes identifier-padding values; this PR’s endian-length handling remains separate. |
|
i caught one remaining gap: accepted length disagreements in |
* commit '4ccc685dd5ed028bc625fdd8760539ce5a492d8d': (228 commits) test(asar): verify cleanup on the original file handle (morluto#15155) fix(ubi): bound smaller-grid probe memoization (morluto#15168) fix(artifacts): distinguish content from containment changes (morluto#15165) fix(bflt): retain complete text when data is truncated (morluto#15160) refactor(domain): reuse graph projection and validation helpers (morluto#15173) fix(iso9660): read a directory record's data length from its little-endian half (morluto#14801) test(ghidra): wait for each fixture spawn before expiring startup (morluto#15172) test(beam): reuse the CLI Evidence reader (morluto#15171) test(oci): share descriptor budget refusal assertions (morluto#15159) refactor(audit): share byte framing for offline audit logs (morluto#15162) refactor(evidence): reuse observed file reports for binary metadata (morluto#15161) fix(doctor): omit package-runner cache shims from installations (morluto#15059) refactor(packages): share package inspection budget contracts (morluto#15158) refactor(desktop): share completed command answer recovery (morluto#15156) refactor(views): share page byte reservations (morluto#15152) refactor(artifacts): share GPU and media asset layout rules (morluto#15150) fix(setup): name the detected host when Hopper setup does not apply (morluto#14449) fix(iso9660): read a directory record whose identifier padding byte is not zero (morluto#15020) fix(windows): report the ACE count a private DACL check observed (morluto#14450) fix(artifacts): read Ogg Opus channel mapping tables (morluto#14975) ...
* commit 'e18ed55bac14191010efe91ba61489cab1d2ba55': (137 commits) fix(artifacts): report macOS package bundle release versions (morluto#14860) test(asar): verify cleanup on the original file handle (morluto#15155) fix(ubi): bound smaller-grid probe memoization (morluto#15168) fix(artifacts): distinguish content from containment changes (morluto#15165) fix(bflt): retain complete text when data is truncated (morluto#15160) refactor(domain): reuse graph projection and validation helpers (morluto#15173) fix(iso9660): read a directory record's data length from its little-endian half (morluto#14801) test(ghidra): wait for each fixture spawn before expiring startup (morluto#15172) test(beam): reuse the CLI Evidence reader (morluto#15171) test(oci): share descriptor budget refusal assertions (morluto#15159) refactor(audit): share byte framing for offline audit logs (morluto#15162) refactor(evidence): reuse observed file reports for binary metadata (morluto#15161) fix(doctor): omit package-runner cache shims from installations (morluto#15059) refactor(packages): share package inspection budget contracts (morluto#15158) refactor(desktop): share completed command answer recovery (morluto#15156) refactor(views): share page byte reservations (morluto#15152) refactor(artifacts): share GPU and media asset layout rules (morluto#15150) fix(setup): name the detected host when Hopper setup does not apply (morluto#14449) fix(iso9660): read a directory record whose identifier padding byte is not zero (morluto#15020) fix(windows): report the ACE count a private DACL check observed (morluto#14450) ...
* commit '76cb6645be39cf3844f7a8bb4568b02d8a713595': (95 commits) fix(macos-pkg): retain cpio hard-link contents (morluto#15157) fix(artifacts): report macOS package bundle release versions (morluto#14860) test(asar): verify cleanup on the original file handle (morluto#15155) fix(ubi): bound smaller-grid probe memoization (morluto#15168) fix(artifacts): distinguish content from containment changes (morluto#15165) fix(bflt): retain complete text when data is truncated (morluto#15160) refactor(domain): reuse graph projection and validation helpers (morluto#15173) fix(iso9660): read a directory record's data length from its little-endian half (morluto#14801) test(ghidra): wait for each fixture spawn before expiring startup (morluto#15172) test(beam): reuse the CLI Evidence reader (morluto#15171) test(oci): share descriptor budget refusal assertions (morluto#15159) refactor(audit): share byte framing for offline audit logs (morluto#15162) refactor(evidence): reuse observed file reports for binary metadata (morluto#15161) fix(doctor): omit package-runner cache shims from installations (morluto#15059) refactor(packages): share package inspection budget contracts (morluto#15158) refactor(desktop): share completed command answer recovery (morluto#15156) refactor(views): share page byte reservations (morluto#15152) refactor(artifacts): share GPU and media asset layout rules (morluto#15150) fix(setup): name the detected host when Hopper setup does not apply (morluto#14449) fix(iso9660): read a directory record whose identifier padding byte is not zero (morluto#15020) ...
* commit '6c7dffc59b970fcfae023af3171d92ee0ac50f94': (137 commits) fix(json): classify JSON input heap headroom and string-ceiling refusals (morluto#14949) fix(macos-pkg): retain cpio hard-link contents (morluto#15157) fix(artifacts): report macOS package bundle release versions (morluto#14860) test(asar): verify cleanup on the original file handle (morluto#15155) fix(ubi): bound smaller-grid probe memoization (morluto#15168) fix(artifacts): distinguish content from containment changes (morluto#15165) fix(bflt): retain complete text when data is truncated (morluto#15160) refactor(domain): reuse graph projection and validation helpers (morluto#15173) fix(iso9660): read a directory record's data length from its little-endian half (morluto#14801) test(ghidra): wait for each fixture spawn before expiring startup (morluto#15172) test(beam): reuse the CLI Evidence reader (morluto#15171) test(oci): share descriptor budget refusal assertions (morluto#15159) refactor(audit): share byte framing for offline audit logs (morluto#15162) refactor(evidence): reuse observed file reports for binary metadata (morluto#15161) fix(doctor): omit package-runner cache shims from installations (morluto#15059) refactor(packages): share package inspection budget contracts (morluto#15158) refactor(desktop): share completed command answer recovery (morluto#15156) refactor(views): share page byte reservations (morluto#15152) refactor(artifacts): share GPU and media asset layout rules (morluto#15150) fix(setup): name the detected host when Hopper setup does not apply (morluto#14449) ...
* commit '91380cff6a6ce8b82b042ceb4e5013f3cc87a9d0': fix(ci): run npm lifecycle hooks in selected host lanes (morluto#15169) fix(artifacts): retain stored files in Godot PCK patches (morluto#15180) fix(setup): do not persist versioned launcher paths (morluto#15123) fix(devicetree): read later FDT versions backwards compatible with v17 (morluto#14136) fix(json): classify JSON input heap headroom and string-ceiling refusals (morluto#14949) fix(macos-pkg): retain cpio hard-link contents (morluto#15157) fix(artifacts): report macOS package bundle release versions (morluto#14860) test(asar): verify cleanup on the original file handle (morluto#15155) fix(ubi): bound smaller-grid probe memoization (morluto#15168) fix(artifacts): distinguish content from containment changes (morluto#15165) fix(bflt): retain complete text when data is truncated (morluto#15160) refactor(domain): reuse graph projection and validation helpers (morluto#15173) fix(iso9660): read a directory record's data length from its little-endian half (morluto#14801) test(ghidra): wait for each fixture spawn before expiring startup (morluto#15172)
* commit '5c3c1edd72453746266691deca2c7355a8df9b0d': (623 commits) fix(dtbo): keep coverage unknown beyond the declared image (morluto#15182) perf(n64): stream ROM byte-order normalization (morluto#15179) fix(oci)!: keep unobserved directory identity unknown (morluto#15164) fix(nds): bind file names to disjoint FNT subtables (morluto#15178) fix(glb): preserve JSON chunk read failures (morluto#15181) fix(ci): run npm lifecycle hooks in selected host lanes (morluto#15169) fix(artifacts): retain stored files in Godot PCK patches (morluto#15180) fix(setup): do not persist versioned launcher paths (morluto#15123) fix(devicetree): read later FDT versions backwards compatible with v17 (morluto#14136) fix(json): classify JSON input heap headroom and string-ceiling refusals (morluto#14949) fix(macos-pkg): retain cpio hard-link contents (morluto#15157) fix(artifacts): report macOS package bundle release versions (morluto#14860) test(asar): verify cleanup on the original file handle (morluto#15155) fix(ubi): bound smaller-grid probe memoization (morluto#15168) fix(artifacts): distinguish content from containment changes (morluto#15165) fix(bflt): retain complete text when data is truncated (morluto#15160) refactor(domain): reuse graph projection and validation helpers (morluto#15173) fix(iso9660): read a directory record's data length from its little-endian half (morluto#14801) test(ghidra): wait for each fixture spawn before expiring startup (morluto#15172) test(beam): reuse the CLI Evidence reader (morluto#15171) ... # Conflicts: # src/cli/cliCommandRegistrations.ts
Summary
Closes #14800
One directory record whose big-endian
data_lengthcopy disagreed with its little-endian half madeinspect_artifactandextract_artifactrefuse the whole ISO 9660 image as malformed, wherever the record sat in the tree. Linux isofs, libarchive and pycdlib read only the little-endian half of a record's data length, because mastering programs have written images whose big-endian copy is wrong. This PR reads that half for records inside directory extents and reports a disagreeing copy as a limitation on the entry, with both values. Volume descriptor fields and each descriptor's root record keep the agreement check.Problem and expected behavior
Smallest trigger: a valid image in which only the big-endian copy (record bytes 14-17) of one file's
data_lengthdiffers from the little-endian half (bytes 10-13).On
main,iso9660DirectoryRecordAtread the field with the strict both-endian reader (src/domain/iso9660/iso9660Structures.ts:290at51b3671b0), and the walk unwraps that failure (src/artifacts/Iso9660ArtifactReader.ts:229), so the inventory ended asmalformedwithout entries. The facts the rest of the image still established were discarded for one field that the common readers do not trust:fs/isofs/isofs.h:93-110).locationandfsizewitharchive_le32deconly (parse_file_info,:1839-1840). It checks both halves only in the primary volume descriptor fields (isPVD,:881-917) and in each descriptor's root record (isRootDirectoryRecord,:973-1016).pycdlib/dr.py:253-258).IsoIn.cpp:162-174).Expected: the file or directory is listed and read with the little-endian length, its entry names both stored values in a limitation, and the rest of the tree is listed. A disagreement in a volume descriptor field or in a descriptor's root record stays
malformed.Change and scope
src/domain/iso9660/iso9660Structures.ts: the first commit splits the half reading out ofreadBothEndian(bothEndianHalves) and names its failure (iso9660HalvesDisagree), without a behavior change. The record parser then keepsdataLengthas the little-endian half and records a disagreeing big-endian copy indataLengthBigEndian, which is null when the halves agree.src/domain/iso9660/iso9660VolumeDescriptors.ts:rootRecord, used for the primary and the Joliet descriptor, raises the sameboth-endian data_length halves disagreefailure at the same offset as before when the root record's halves disagree.src/domain/iso9660/iso9660Members.ts: a member keeps every section whose copy disagrees (dataLengthDisagreements), so each section of a multi-extent file is named.src/artifacts/Iso9660ArtifactReader.ts: the entry carriesISO 9660 directory record at byte N stores data_length A in its little-endian half and B in its big-endian copy; the entry uses the little-endian value, and which half is correct is unknown.docs/guides/firmware/iso9660-images.md: the exception and the root record rule.The
.and..records are records inside directory extents too, so their little-endian length is compared with the record each one repeats (the directory's own record, its parent's, and for the root the descriptor's strict root record). They create no entry. If their big-endian copy disagrees, inventory coverage preserves a limitation naming the directory, record role, byte offset, and both values.Not included:
isRootDirectoryRecordrequires. Linux and pycdlib do not check them, but relaxing them would need a volume-level limitation and has weaker support.iso9660-entrymetadata: that would change its public shape and the generated catalog, and the limitation keeps both values.Contribution scope: ordinary fix within existing boundaries (static format inspection); maintainer scope decision not applicable.
Contract and boundary impact
iso9660DirectoryRecordAtowns record parsing forrootRecordand forparseIso9660DirectoryExtent;groupIso9660MembersandentryForconsume the new fact. Every consumer ofdataLength(extentOf,assertMandatoryLink,admitIso9660Extentand the directory byte budget) already used the little-endian value, which is unchanged when the halves agree. Distinguishing case: the same disagreeing copy is listed with a limitation in a record inside an extent and staysmalformedin a descriptor's root record.declared_sizeandsource_locationfollow the little-endian length, and the limitation keeps the disagreeing value visible.docs/public/product-catalog.json), package, or installation impact: none.Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.
Evidence and regression coverage
src/artifacts/Iso9660ArtifactReader.boundaries.test.ts: "fails a both-endian directory record disagreement as malformed" becomes "lists %s by its little-endian data length when the big-endian copy disagrees", for the filetop.txtand the directorydir. ThroughscanCanonicalArtifactInventory, the entry reportsdeclared_sizeequal to the little-endian length and the limitation with both values, andtop.txtanddir/inner/file.binare still listed with verified hashes; fordir, its extent is walked with the little-endian length. On the base reader both cases reject asmalformedatdata_length, which is what the replaced case asserted.src/domain/iso9660/iso9660Structures.test.ts, "keeps a descriptor root record's data length halves in agreement (Joliet: %s)": a disagreeing copy in the primary or the Joliet descriptor's root record staysmalformedat that field's offset.src/artifacts/Iso9660ArtifactReader.boundaries.test.ts, "names each disagreeing section of a multi-extent file and none of the next file": both sections of a contiguous two-section file carry a disagreeing copy, followed by a clean file. The file keeps its summed little-endian size and verified hash, its entry names both records with their own values in section order, and the next file carries no disagreement.Boundary regressions: format assumptions (the accepted disagreement inside an extent is paired with the same disagreement in a descriptor's root record, which stays malformed) and missing or unknown values (the uncertain row is kept with its limitation, and its sibling and nested facts survive).
For evidence-bearing changes:
Validation performed
iso9660DirectoryRecordAt, its two callers,groupIso9660Members,entryFor,IsoTree.addanddirectoryExtent, and every ISO 9660 test that writes a big-endian half (rgoversrcandtests): only the replaced case wrote disagreeing halves inside a directory extent.main(21cfc809b) is merged into the branch at3ef5a505a. The only conflict was the doc comment ofrootRecord, which fix(iso9660): read the descriptor's root record from its fixed 34-byte field #15002 rewrote. The mergedrootRecordreads the root through the fixed 34-byte extent from fix(iso9660): read the descriptor's root record from its fixed 34-byte field #15002 and keeps this PR's agreement check on the root's data length. The..relaxation from fix(iso9660): read Joliet trees whose .. records name their own directory #14817 compares the little-endian length, as the other mandatory link checks do.3ef5a505a(run 46163672367): Static checks, Documentation, Build package, Portable tests, Native package baseline (linux x64), Build bundled Windows x64 native controls, Test shard (1/1),apk_signature / real-apk-signatureand CI required passed; none failed. The shard selected 5 affected files and ran 476 tests: 475 passed and 1 was skipped insrc/artifacts/ReleaseExposureReader.test.ts, which this PR does not change. The selection includedsrc/domain/iso9660/iso9660Structures.test.ts(25),src/artifacts/Iso9660ArtifactReader.boundaries.test.ts(73) andsrc/artifacts/Iso9660ArtifactReader.test.ts(11).9602f8586failedformat:checkon the new multi-extent case, whiche247f5a1breformats.Compatibility, safety, and release
rea-agents-6.10.1does not containe896f6054).Maintainer validation
.and..records. Commit7a0008d8f448347f8cb060c42943d013cb60ed25preserves those facts in inventory coverage without creating synthetic entries.Author readiness
Human owner: @viniciusdsandrade
Author checklist (completed by the PR author before requesting review)
type(scope): outcome.REA_runtime setting with a default, floor, and maximum, unless a fixed ceiling has a stated reason. See Adding a runtime setting.