-
Notifications
You must be signed in to change notification settings - Fork 4
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
Fix ExFAT parsing with clusters larger than one sector #31
Conversation
Hey @Lekensteyn thank you for the fix! I believe it should be possible to upload files to |
@Lekensteyn thank you for your contribution! As this is your first code contribution, please read the following Contributor License Agreement (CLA). If you agree with the CLA, please reply with the following information:
Contributor License Agreement
Contribution License AgreementThis Contribution License Agreement ("Agreement") governs your Contribution(s) (as defined below) and conveys certain license rights to Fox-IT B.V. ("Fox-IT") for your Contribution(s) to Fox-IT"s open source Dissect project. This Agreement covers any and all Contributions that you ("You" or "Your"), now or in the future, Submit (as defined below) to this project. This Agreement is between Fox-IT B.V. and You and takes effect when you click an “I Accept” button, check box presented with these terms, otherwise accept these terms or, if earlier, when You Submit a Contribution.
|
@DissectBot agree |
19565fa
to
37d89e7
Compare
Looks like it worked, the git-lfs object is also visible in this repo! My local tests pass, fingers crossed that CI will also be happy :)
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #31 +/- ##
==========================================
+ Coverage 81.89% 82.00% +0.10%
==========================================
Files 6 6
Lines 497 500 +3
==========================================
+ Hits 407 410 +3
Misses 90 90
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
With this the CI should pass.
The existing `exfat.bin` testcase is configured with a sector size equal to the cluster size. When that is not the case, parsing the root directory and subdirectory entries fails with an EOFError. Since directory entries are sector-aligned, reduce the block size to match. Fix some mistakes and clarify the documentation while at it. Fixes a crash reproduced with with exfatprogs version 1.2.6: truncate -s 4M exfat4m.bin; mkfs.exfat exfat4m.bin python3 -c 'from dissect.fat import ExFAT; fs = ExFAT(open("exfat4m.bin", "rb")); print(fs.files["/"][1].keys())' This check for a file and subdirectory also passes now: # mount exfat4m.bin /mnt # mkdir /mnt/subdir # touch /mnt/file.txt /mnt/subdir/sub.txt # umount /mnt $ python3 -c 'from dissect.fat import ExFAT; fs = ExFAT(open("exfat4m.bin", "rb")); print(fs.files["/"][1]["subdir"][1].keys())' odict_keys(['sub.txt']) $ python3 -c 'from dissect.fat import ExFAT; fs = ExFAT(open("exfat4m.bin", "rb")); print(fs.files["/"][1].keys())' odict_keys(['subdir', 'file.txt']) This test file has been included in the test suite.
37d89e7
to
d681187
Compare
|
||
# TODO Graceful way to construct a runlist of non-fragmented streams spanning multiple sectors | ||
if size: | ||
run = -(-size // self.cluster_size) | ||
run = -(-size // self.cluster_size) * sectors_per_cluster |
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.
The coverage checker is complaining about this branch. Not much to be done here, this code is unused.
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.
That’s fine for now. This specific file system implementation is due for a rewrite since it’s not compatible anymore with the rest of the Dissect API.
The existing
exfat.bin
testcase is configured with a sector size equal to the cluster size. When that is not the case, parsing the root directory and subdirectory entries fails with an EOFError. Since directory entries are sector-aligned, reduce the block size to match. Fix some mistakes and clarify the documentation while at it.Fixes a crash reproduced with with exfatprogs version 1.2.6:
This check for a file and subdirectory also passes now:
This test file has been included in the test suite.