Skip to content

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

Open
francisdb wants to merge 1 commit into
mdsteele:masterfrom
francisdb:fix/permissive-fat-pointee
Open

fix: tolerate a FAT entry that points past the file under Permissive#91
francisdb wants to merge 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.

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.
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

1 participant