Skip to content

Commit 17e26cd

Browse files
author
alexmullins
committed
fix slice index out of range when dealing with compressed files.
1 parent edac1e8 commit 17e26cd

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

README.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,5 @@ Refer to http://www.winzip.com/aes_info.htm#winzip11 for the reasoning.
6767
16. Storage Format (file data payload) totals CompressedSize64 bytes:
6868
a. Salt - 8, 12, or 16 bytes depending on keysize
6969
b. Password Verification Value - 2 bytes
70-
c. Encrypted Data - UncompressedSize64 bytes
70+
c. Encrypted Data - compressed size - satl - pwv - auth lengths
7171
d. Authentication code - 10 bytes

reader.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ func newDecryptionReader(r io.Reader, f *File) (io.Reader, error) {
218218
salt := content[:saltLen]
219219
pwvv := content[saltLen : saltLen+2]
220220
content = content[saltLen+2:]
221-
size := f.UncompressedSize64
221+
size := f.CompressedSize64 - uint64(saltLen) - 2 - 10
222222
data := content[:size]
223223
authcode := content[size:]
224224
// generate keys

0 commit comments

Comments
 (0)