Open ghost opened 8 years ago
Hi thanks for your comments. I have just integrated those now.
Few comments on my side:
OK, a couple more minor edits and we should be done. Thanks for your work!
ZZRaiseErrorNo
as an early return which is the convention.checkXYZ:
method declarations in the @interface ZZOldArchiveEntry()
extension.Please note that within the check of the local header (checkLocalHeader) I am now doing this check: _localFileHeader->compressionMethod != _centralFileHeader->compressionMethod instead of _localFileHeader->compressionMethod != self.compressionMethod.
That looks fine.
I believe i already asked but do you see a way to corrupt a local header by taking as ressource one of your encrypted AES file?
You can try corrupting a local header by open an NSData
from the file, figuring what offset the zeroes have to be, writing some zeroes there and then open a ZZArchive
with the data. If that's too finicky to work, I'm happy to accept the corrupted file in the test case.
I have integrated your last comments. I have managed also to corrupt the local header of your original small-test-encrypted-aes file by zeroing out some of the local header fields (versionNeededToExtract, generalPurposeBitFlag, compressionMethod, lastModFileName). This was feasible by identifying the local header signature in the file (504b 0304) and the offset for the next fields i wanted to zero out.
I hope this looks good to you now :-) - have a nice w.e!
I'm sorry for not getting back to you sooner -- had a busy month, both in life and work.
I really do appreciate the work you've put into this!
However, you'll need to be careful to respect the project style throughout. I see still quite a few bracket style exceptions. Please rebase to integrate any style fixes with the commits that originated them.
Also, where you've made certain methods part of the class extension, both the class extension methods and their implementation should be part of the same commit.
This is so that we can just inspect one commit and see everything that's needed to make it work there, rather than having to inspect multiple commits. Also helps git bisect
and other automated debugging procedures.
Also, when I meant "corrupt the original test archive", I actually meant to do this in the test case e.g. in setUp
and tearDown
. This avoids having to include another zip file in the package, since we can copy the existing zip file and corrupt it for testing in setUp
, then delete the copy in tearDown
.
Thanks for your pull request. In general it looks good, but several minor issues to fix.
As a first pass, please rebase these to atomic commits. Each commit should be tightly focussed on one thing. For example:
Merge or drop typos and bad commits. Split up @18d7f9c into two commits. You can use a
git rebase -i
to do this and thengit push --force
to update this pull request.Other general comments:
ZZWinZipAESExtraField* winZipAESRecord
instead ofZZWinZipAESExtraField *winZipAESRecord
.YES
andNO
, nottrue
andfalse
.check:
method into several separate methods! Do put the method declarations in the@interface ZZOldArchiveEntry()
extension.checkEncryptionAndCompressionMode:
and callcheckEncryptionMode:
andcheckCompressionMode:
directly. Looks cleaner and easier to reason about the logic.getLocalEncryptionMode
appears to only be used incheckLocalEncryptionMode
and doesn't really make sense as a separate piece of code e.g. no need to be in public interface. Integrate that intocheckLocalEncryptionMode
.checkCRC:
method checks forversionNumber
, use aswitch
statement instead of multipleif
as this makes the code clearer.validateCRC:
method appears to always returntrue
. Not your fault, this is a pre-existing problem! Best to drop that method entirely since I don't see how we could actually check CRC before decompressing and/or decrypting. You should leave intact the validation of zero CRC forversion_AE2
though.