Skip to content

Commit

Permalink
Fixed ASAN integer-overflow if cd_offset + cd_size > INT64_MAX.
Browse files Browse the repository at this point in the history
  • Loading branch information
nmoinvaz committed Jan 30, 2021
1 parent 6f17da5 commit 2bc5f17
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mz_zip.c
Expand Up @@ -1072,7 +1072,7 @@ static int32_t mz_zip_read_cd(void *handle) {
if (eocd_pos < zip->cd_offset) {
/* End of central dir should always come after central dir */
err = MZ_FORMAT_ERROR;
} else if (eocd_pos < zip->cd_offset + zip->cd_size) {
} else if (eocd_pos < (uint64_t)zip->cd_offset + zip->cd_size) {
/* Truncate size of cd if incorrect size or offset provided */
zip->cd_size = eocd_pos - zip->cd_offset;
}
Expand Down

0 comments on commit 2bc5f17

Please sign in to comment.