Skip to content
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

handle large sectors_per_cluster (closes #12) #13

Closed
wants to merge 2 commits into from

Conversation

leofidus
Copy link
Contributor

@leofidus leofidus commented Mar 10, 2022

This follows Wikipedia's description "If the value is greater than 0x80, the amount of sectors is 2 to the power of the absolute value of considering this field to be negative."

Annoyingly sectors_per_cluster can't just be an i8 with different behavior depending on the sign because that breaks for 128 (so a cluster size of 64k).

@leofidus
Copy link
Contributor Author

Added some error handling, which is probably the controversial part of this. You could as easily argue that MAXIMUM_SECTORS_PER_CLUSTER_EXPONENT should be 12, and since sector_size() is restricted to 512 that would allow cluster_size to fit everything in u32. Instead I went for a version that separates these assumptions more, making it easier to change them if ever necessary.

ColinFinck added a commit that referenced this pull request Mar 13, 2022
A cluster size of 2 MiB is the maximum currently supported by Windows.
See https://dfir.ru/2019/04/23/ntfs-large-clusters/ for more details.

Fixes #12
Thanks to @leofidus for the initial implementation in #13!

Co-authored-by: Jannis Froese <jannis.froese@deepsign.de>
@ColinFinck
Copy link
Owner

Thanks for the report and the PR!
I've adapted your fix after my recent changes and committed something similar in d15e4ca.

@ColinFinck ColinFinck closed this Mar 13, 2022
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.

2 participants