fix slice index out of range when dealing with compressed files.

This commit is contained in:
alexmullins 2015-10-29 19:14:48 -05:00
parent edac1e895f
commit 17e26cdce5
2 changed files with 2 additions and 2 deletions

View File

@ -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:
a. Salt - 8, 12, or 16 bytes depending on keysize
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

View File

@ -218,7 +218,7 @@ func newDecryptionReader(r io.Reader, f *File) (io.Reader, error) {
salt := content[:saltLen]
pwvv := content[saltLen : saltLen+2]
content = content[saltLen+2:]
size := f.UncompressedSize64
size := f.CompressedSize64 - uint64(saltLen) - 2 - 10
data := content[:size]
authcode := content[size:]
// generate keys