Repository navigation
Conversation
Adds fs/fat16.hexpat, covering both FAT12 and FAT16 volumes: - Boot sector with BPB and extended BPB (0x28 / 0x29 boot signatures) - All FATs, with packed 12 bit entries decoded for FAT12 and every entry labelled (free, next cluster, end of chain, bad, reserved) - The fixed root directory, then every subdirectory and file followed through its FAT cluster chain, including fragmented chains and directories spanning several cluster runs - VFAT long file name entries, deleted entries, volume labels and the Windows NT lowercase flags for 8.3 names - FAT type chosen from the cluster count as the specification requires; FAT32 volumes are rejected with a pointer to fs/fat32.hexpat - Cluster chains are walked iteratively, one array element per run of consecutive clusters, so a long or fragmented chain cannot exhaust the stack; a chain is never followed for more clusters than the volume has - Guards for corrupted images: directory loops, nesting deeper than 64 levels, more than 10000 directories, and a BPB claiming more clusters than its FAT can hold - Images cut off part way (partial dumps) are parsed up to where they end: FATs, root directory and data runs are clamped to the file fs/pattern.hexpat now dispatches MBR partition types 0x01, 0x04, 0x06, 0x0E and their hidden variants to the new pattern instead of failing with "Unknown MBR Partition Type". Test images were made with mkfs.fat and mtools and contain only generated data. The FAT16 image is cut off after its last allocated cluster to keep it at 25 KiB. Closes WerWolv#108
ImadC9
force-pushed
the
feat/fs-fat12-fat16
branch
from
October 9, 2026 20:50
2e2e9bd to
96b4b2a
Compare
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.
Pattern
Closes #108.
Adds
patterns/fs/fat16.hexpatfor FAT12 and FAT16 volumes, the two FAT variants that were still missing next tofat32.hexpatandexfat.hexpat.FAT12string. FAT32 volumes are rejected with a pointer tofat32.hexpat.fs/pattern.hexpatnow dispatches MBR partition types 0x01, 0x04, 0x06 and 0x0E (and their hidden variants) to the new pattern. Previously a disk with a FAT16 partition stopped withUnknown MBR Partition Type MBRPartitionType::FAT16_32MBPlus. Output for the existingfs.hexpat.imgis byte-identical.Verification
Every file the pattern finds was rebuilt from its data runs and compared byte-for-byte with what
mcopy -s(mtools) extracts:fs/pattern.hexpat, and file bytes inside both partitions match.Test data
tests/patterns/test_data/fat16.hexpat/holds two images made with mkfs.fat and mtools from generated data:fat12.img, 64 KiBfat16.img, a FAT16 volume cut off after its last allocated cluster to keep it at 25 KiB; it parses identically to the full 2.2 MB imageNote:
tests/patterns/CMakeLists.txtonly globspatterns/*.hexpat, so nothing underpatterns/fs/runs in CI today, including the existingext4andfstest files. The images follow the naming convention so they will be picked up if subfolders are added. A recursive glob currently collides on 8 duplicate test names, so that needs its own change; happy to send one.Checklist
application/octet-stream, so detection uses#pragma magicon theFAT12/FAT16signature instead, likefat32.hexpatandexfat.hexpat