Skip to content

Fix inverted big-endian extent check in ISO 9660 directory parsing - #98

Merged
mnadareski merged 1 commit into
SabreTools:mainfrom
gmipf:fix-iso-bigendian-extent
Oct 15, 2026
Merged

mnadareski merged 1 commit into
SabreTools:mainfrom
gmipf:fix-iso-bigendian-extent

Conversation

@gmipf

@gmipf gmipf commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

ParseDirectory parses the big-endian extent when dr.ExtentLocation.IsValid (both values equal), but the comment says it should do so when the location is ambiguous. ISO9660.Extraction.cs and ISO9660.Printing.cs already use !IsValid for this check.

With the current condition every directory is parsed a second time together with its subtree, so the reads double with each directory level, and a differing big-endian location is never parsed.

Measured with ISO9660.Create on 8 Redump images (PS1 to PS5, three PC discs): the parsed model is identical, the reads drop, e.g. Minecraft PS3 Edition from 26.9 MiB to 0.29 MiB, Commandos from 2.3 MiB to 0.18 MiB.

Two new ParseDirectory tests fail without the change and pass with it.

Prepared with AI assistance (Claude Opus 5.5) and reviewed before submission.

ParseDirectory parsed the big-endian extent when the extent location
was valid (both values equal) instead of when it was ambiguous, so
every directory was parsed again, once per directory level.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mnadareski
mnadareski requested a review from Deterous October 15, 2026 00:49
@mnadareski

Copy link
Copy Markdown
Member

I've tagged Det to review this because I'm not 100% sure what that check was supposed to be doing in the first place.

@Deterous

Copy link
Copy Markdown
Member

Yes the if (!bigEndian && !dr.ExtentLocation.IsValid) should have the not in front of IsValid, nice find.

Up to you whether all that test code is needed.

@mnadareski mnadareski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests do feel a bit overkill, but they definitely prove it's working. The test suite for the readers is lacking, to say the least.

@mnadareski
mnadareski merged commit 2f6698e into SabreTools:main Oct 15, 2026
1 check passed
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.

3 participants