Skip to content

fix: tolerate a FAT entry that points past the file under Permissive - #91

Merged
mdsteele merged 1 commit into
mdsteele:masterfrom
francisdb:fix/permissive-fat-pointee
Sep 14, 2026
Merged

mdsteele merged 1 commit into
mdsteele:masterfrom
francisdb:fix/permissive-fat-pointee

Conversation

@francisdb

Copy link
Copy Markdown
Contributor

Fixes #80.

A FAT entry pointing beyond the last sector rejected the whole file even when no chain ran through it, unlike the neighbouring FAT and DIFAT marker checks, which repair under Permissive. The entry now ends its chain under Permissive, so only a stream that actually uses that sector is affected (its read fails with UnexpectedEof); Strict still rejects the file with the same message.

Ending the chain rather than marking the sector free keeps it off the free list, so it cannot be handed out for new data, and a chain reaching it truncates instead of erroring on the walk.

Tests include the reproduction from the issue, its Strict counterpart, and a case where a live chain runs through the bad entry.

@francisdb
francisdb force-pushed the fix/permissive-fat-pointee branch from a438f16 to c4cbd2b Compare September 9, 2026 05:56
A FAT entry pointing beyond the last sector rejected the whole file
even when no chain ran through it. Under Permissive validation the entry
now ends its chain instead, so only a stream that actually uses that
sector is truncated. Strict validation still rejects the file.
@francisdb
francisdb force-pushed the fix/permissive-fat-pointee branch from c4cbd2b to ecb83b6 Compare September 10, 2026 06:13
@mdsteele
mdsteele merged commit 75e8a02 into mdsteele:master Sep 14, 2026
4 checks passed
@francisdb
francisdb deleted the fix/permissive-fat-pointee branch September 15, 2026 09:43
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.

Out-of-range FAT entry rejects the whole file even under Validation::Permissive

2 participants