Skip to content

Commit cf2895e

Browse files
committed
Fix potential integer overflow in zip.ExtractSafe check
1 parent 49bba22 commit cf2895e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

zip/zip.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func ExtractSafe(source io.ReaderAt, length int64, target string, uncompressedBy
4242
for _, f := range reader.File {
4343
actualUncompressedSize += f.FileHeader.UncompressedSize64
4444
}
45-
if uncompressedBytes < int64(actualUncompressedSize) {
45+
if uncompressedBytes < 0 || actualUncompressedSize > uint64(uncompressedBytes) {
4646
return ErrorSizeMismatch
4747
}
4848

0 commit comments

Comments
 (0)