diff options
author | Julien Voisin <jvoisin@google.com> | 2022-10-13 14:13:19 +0200 |
---|---|---|
committer | Julien Voisin <jvoisin@google.com> | 2022-10-16 18:43:29 +0200 |
commit | 98ce79a52ca67e0d0b6b2c867c1aa327c6c58240 (patch) | |
tree | fcc8259480c46794d80fec2aa956f158fdd24961 /libarchive/archive_read_support_format_7zip.c | |
parent | 552547eacf6bfbdf5052f33cad57f181b6f92a61 (diff) | |
download | libarchive-98ce79a52ca67e0d0b6b2c867c1aa327c6c58240.tar.gz |
Extend the usage of the DONT_FAIL_ON_CRC_ERROR macro
DONT_FAIL_ON_CRC_ERROR is already used in the rar5 support code, so let's make
use of it in another places as well. This should tremendously help with
fuzzing.
Diffstat (limited to 'libarchive/archive_read_support_format_7zip.c')
-rw-r--r-- | libarchive/archive_read_support_format_7zip.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libarchive/archive_read_support_format_7zip.c b/libarchive/archive_read_support_format_7zip.c index 9142051e..0ba4bee3 100644 --- a/libarchive/archive_read_support_format_7zip.c +++ b/libarchive/archive_read_support_format_7zip.c @@ -2857,8 +2857,10 @@ slurp_central_directory(struct archive_read *a, struct _7zip *zip, /* CRC check. */ if (crc32(0, (const unsigned char *)p + 12, 20) != archive_le32dec(p + 8)) { +#ifdef DONT_FAIL_ON_CRC_ERROR archive_set_error(&a->archive, -1, "Header CRC error"); return (ARCHIVE_FATAL); +#endif } next_header_offset = archive_le64dec(p + 12); @@ -2908,8 +2910,10 @@ slurp_central_directory(struct archive_read *a, struct _7zip *zip, /* Check the EncodedHeader CRC.*/ if (r == 0 && zip->header_crc32 != next_header_crc) { archive_set_error(&a->archive, -1, +#ifndef DONT_FAIL_ON_CRC_ERROR "Damaged 7-Zip archive"); r = -1; +#endif } if (r == 0) { if (zip->si.ci.folders[0].digest_defined) @@ -2960,9 +2964,11 @@ slurp_central_directory(struct archive_read *a, struct _7zip *zip, /* Check the Header CRC.*/ if (check_header_crc && zip->header_crc32 != next_header_crc) { +#ifndef DONT_FAIL_ON_CRC_ERROR archive_set_error(&a->archive, -1, "Malformed 7-Zip archive"); return (ARCHIVE_FATAL); +#endif } break; default: |