Skip to content

Conversation

sftse
Copy link
Contributor

@sftse sftse commented Jul 3, 2025

While investigating #63 we found a file that has FREE_SECTOR in the middle of the FAT.
Since the location and number of FREE_SECTOR is arbitrary, it should be possible to hit this error if FREE_SECTOR are counted as a legitimate sector that must exist in the CFB.

Don't know what I was thinking, having FREE_SECTOR in the middle of the file is also going to increase the file size and thus num_sectors.

@sftse
Copy link
Contributor Author

sftse commented Jul 3, 2025

Added the fix for #63. The issue is that the FAT is inconsistent with the DIFAT. The DIFAT chain in the header is much shorter, so for some reason the DIFAT consists of multiple disconnected components and does not include the DIFAT_SECTOR that is mentioned in the FAT.

The fix is sufficient for my case, since I either only need to read the CFB or if I need to write to it the CFB is created from scratch and will be well-formed.
I expanded the initial test to see whether the allocator falls over these additional sectors when writing to the file, and indeed it does. I don't have a fix ready yet.

@sftse
Copy link
Contributor Author

sftse commented Jul 3, 2025

Turning the check off entirely is probably overly permissive. I'll see if I can come up with something more restrictive.

@sftse sftse closed this Jul 4, 2025
@sftse sftse mentioned this pull request Jul 4, 2025
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.

1 participant