forked from mirror/zip
fix slice index out of range when dealing with compressed files.
This commit is contained in:
parent
edac1e895f
commit
17e26cdce5
|
@ -67,5 +67,5 @@ Refer to http://www.winzip.com/aes_info.htm#winzip11 for the reasoning.
|
||||||
16. Storage Format (file data payload) totals CompressedSize64 bytes:
|
16. Storage Format (file data payload) totals CompressedSize64 bytes:
|
||||||
a. Salt - 8, 12, or 16 bytes depending on keysize
|
a. Salt - 8, 12, or 16 bytes depending on keysize
|
||||||
b. Password Verification Value - 2 bytes
|
b. Password Verification Value - 2 bytes
|
||||||
c. Encrypted Data - UncompressedSize64 bytes
|
c. Encrypted Data - compressed size - satl - pwv - auth lengths
|
||||||
d. Authentication code - 10 bytes
|
d. Authentication code - 10 bytes
|
||||||
|
|
|
@ -218,7 +218,7 @@ func newDecryptionReader(r io.Reader, f *File) (io.Reader, error) {
|
||||||
salt := content[:saltLen]
|
salt := content[:saltLen]
|
||||||
pwvv := content[saltLen : saltLen+2]
|
pwvv := content[saltLen : saltLen+2]
|
||||||
content = content[saltLen+2:]
|
content = content[saltLen+2:]
|
||||||
size := f.UncompressedSize64
|
size := f.CompressedSize64 - uint64(saltLen) - 2 - 10
|
||||||
data := content[:size]
|
data := content[:size]
|
||||||
authcode := content[size:]
|
authcode := content[size:]
|
||||||
// generate keys
|
// generate keys
|
||||||
|
|
Loading…
Reference in New Issue