-
Notifications
You must be signed in to change notification settings - Fork 29
Pad with free #66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pad with free #66
Conversation
src/internal/consts.rs
Outdated
} | ||
|
||
#[derive(Clone, PartialEq, Eq)] | ||
pub(crate) enum Ty { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does Ty
stand for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Short for Type
. Muscle memory kicked in because type
is a reserved keyword, commonly abbreviated to ty
, but doesn't have the same issue when uppercased as Type
. Can change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, thanks
Some cfbs manage to mislabel their sectors so badly that their DIFAT chain mentions sectors that are labeled FREE in the FAT. When the trimming of the FAT strips those sectors from the end of the FAT, these will error with 'Malformed FAT (FAT has 14976 entries, but DIFAT lists 14976 as a DIFAT sector)' By ensuring the FAT is always padded with FREE_SECTOR to the end of the file, fn validate() has a chance to correct the mislabeled sectors.
Rebased on master |
I ran into errors of the form
and tracked it down to a
FREE_SECTOR
at the end of the file. When theFREE_SECTOR
are stripped from the end of the FAT, and the DIFAT points to that sector, then the call tofn validate
will not have a chance to try and fix the .cfb.With this fix the files that had the error now succeed.
I may try and come up with a synthetic version of those files, but I'm making this PR without them for now. I also added some of the code I wrote to debug this.