-
Notifications
You must be signed in to change notification settings - Fork 200
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
Instantiation of decrypted stream is crashing for some zip file (AES 256) #141
Comments
Thanks for figuring out and working on this issue! Your instinct is correct in that we'll need to return an error where the file is corrupt wherever possible. However, the listed sanity check is not the place to do it. The check The best spot to add a check is If you can add a simple check for the local file header signature there (and possibly rename the method to something more sensible) in a single-commit pull request, I'll merge it in. Alternatively, you could merge |
Hi thanks for your feedbacks: i will work on the fix today. In the mean time is there any reason why the method |
Historically, Merging the |
I agree with you the I have an other question. I can see that there is a check for the standard encrypted CRC. What CRC is for and does it make sense to have a test on CRC for AES encryption? (Any input on how to test would be much appreciated). |
You can check out what the CRC is for AES encryption here: http://www.winzip.com/aes_info.htm#CRC |
OK thanks - is it possible to run directly your test within your project? it doesn't seem to be the case although test files are present within the project. I want to add an additional test for a corrupted AES256 zip file. |
The testing scheme is OS X only. If you want to add a test for AES256 corruption, use an existing valid test zip file and apply your corruption to a copy (presumably it's zeroing out some bytes?), rather than including a corrupted zip file in the package. This can eventually be the basis for a fuzz test by selectively zeroing out different parts of the zip file. |
I have merged the I couldn't reproduce a corrupted zip file by editing one of your zip file though so i ended up adding the zip file that was crashing on my project. I was also able to add a unit test for that file. You can check my commit on my fork repo: if that's sound good to you i will make a pull request. |
Thanks for the work! It looks good to me with only a few minor nits. Do make the pull request and we can discuss the issues and amend/add any commits needed then. I will ask you to rebase your commits to fix these minor nits so you may prefer to put your commits in a different github branch before making the pull request. |
Great i will take care of the pull request then and rebase my commits as you ask. |
Done #143 |
Hi Glen - do you need some additional actions from my side to validate my pull request? |
Hi there.
I am experimenting some crash when trying to unarchive a specific AES256 encrypted zip. The following invocation will crash:
decryptedStream = [[ZZAESDecryptInputStream alloc] initWithStream:dataStream password:password header:_localFileHeader->fileData() strength:_localFileHeader->extraField<ZZWinZipAESExtraField>()->encryptionStrength error:error]; }
This is because in some cases the
_localFileHeader
doesn't contain any data and as a result the encryptionStrength can't be extracted. I have found out that the file was corrupted but i believe we should return an error in this case.I have now added this additional sanity check before the creation of the localFileHeader:
nextCentralFileHeader->relativeOffsetOfLocalHeader == 0 && *beginContent == '\0
for the following section:
What do you think? If this sounds correct to you i will make a pull request.
Thanks in advance for your input on that matter.
The text was updated successfully, but these errors were encountered: