Repository navigation
hfs: fix catalog scans and header validation - #25
Merged
Merged
Conversation
The catalog descent followed the last index key whose parent CNID was not greater than the directory being listed. All of a directory's records except those in that last leaf were skipped, so a listing lost most of its entries once the catalog spanned several leaf nodes. A test HFS+ disc listed 9 of 402 root entries. Follow the last key before the directory instead, which can lead to the leaf holding its first records, in both the HFS and HFS+ backends. Add a multi-leaf HFS+ fixture.
The catalog header was read while cat_node_size was still zero, so hfs_read_node() copied nothing and the header check ran on an uninitialized stack buffer. The mount failed, pure HFS discs were rejected, and hybrid discs fell back to their ISO 9660 view. The HFS tests passed against that fallback because its names match. Set the node size to the header size for that read. Check the real HFS names in the existing tests, and test a disc with no ISO 9660 side.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two HFS catalog bugs made discs list incompletely or fail to mount as HFS.
hfs: start directory scans at the first matching leaf: the catalog descent followed the last index key at or below the directory's parent CNID, so entries before the last leaf were skipped once the catalog spanned several leaf nodes. A test HFS+ disc listed 9 of 402 root entries. Fixed in both the HFS and HFS+ backends, with a multi-leaf HFS+ fixture.hfs: read the catalog header before validating it: the header was read whilecat_node_sizewas still zero, so the check ran on an uninitialized stack buffer. Pure HFS discs were rejected and hybrid discs fell back to ISO 9660, which hid the bug because the names match. The tests now check real HFS names and cover a disc with no ISO 9660 side.These are cherry-picked onto main from
hfs-catalog-fixes, without the regparm and README commits on that branch.Tested with
make checkandmake golden-check(58 format tests passed; the real AS fixture was skipped because it is unavailable).