[fs][fat] fix false EOF error on cluster-aligned reads#507
Closed
leon-chen1127 wants to merge 1 commit into
Closed
[fs][fat] fix false EOF error on cluster-aligned reads#507leon-chen1127 wants to merge 1 commit into
leon-chen1127 wants to merge 1 commit into
Conversation
When a file read reaches the end of a cluster and the total read length is exactly aligned with the cluster boundary, the iterator speculatively fetches the next sector. This causes the FAT driver to hit the EOF marker in the FAT table, returning ERR_OUT_OF_RANGE. This patch adds a check to skip the next sector fetch if the target length has already been met. Tested with a 4KB/8KB file on a FAT12/FAT16/FAT32 image for typical cluster sizes (e.g., 1KB, 2KB, 4KB), ensuring that the cluster boundary condition is triggered regardless of the specific FAT type.
Member
|
Great catch! I'm about to roll a big pile of changes (read-write support) to master from the wip/fat branch but it looks like this would apply on top of it cleanly so I'll hold off merging this in until I get that branch in, which should happen soon. Thanks! |
Member
|
@copilot resolve the merge conflicts in this pull request |
Member
|
Resolved and pushed upstream. It didn't pick up that it completed this pull, but it did. Thanks! |
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.
When a file read reaches the end of a cluster and the total read length is exactly aligned with the cluster boundary, the iterator speculatively fetches the next sector. This causes the FAT driver to hit the EOF marker in the FAT table, returning ERR_OUT_OF_RANGE.
This patch adds a check to skip the next sector fetch if the target length has already been met.
Tested with a 4KB/8KB file on a FAT12/FAT16/FAT32 image for typical cluster sizes (e.g., 1KB, 2KB, 4KB), ensuring that the cluster boundary condition is triggered regardless of the specific FAT type.