diff options
author | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2001-06-27 06:15:50 +0000 |
---|---|---|
committer | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2001-06-27 06:15:50 +0000 |
commit | 66bcf7ef41bfc50976f30736401e681bbe23d75d (patch) | |
tree | dbbf9f3fc4c9c3641ed07a33edee33bf7226e27e /archival | |
parent | 1a1114f3d656d33b562ce5e155270f0afecc84b2 (diff) | |
download | busybox-w32-66bcf7ef41bfc50976f30736401e681bbe23d75d.tar.gz busybox-w32-66bcf7ef41bfc50976f30736401e681bbe23d75d.tar.bz2 busybox-w32-66bcf7ef41bfc50976f30736401e681bbe23d75d.zip |
Fix a type promotion bug discivered and analyzed by Alan Modra
<amodra@bigpond.net.au>, which caused false checksum errors
git-svn-id: svn://busybox.net/trunk/busybox@2917 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'archival')
-rw-r--r-- | archival/libunarchive/decompress_unzip.c | 2 | ||||
-rw-r--r-- | archival/libunarchive/unzip.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/archival/libunarchive/decompress_unzip.c b/archival/libunarchive/decompress_unzip.c index 7de28930a..40b8af427 100644 --- a/archival/libunarchive/decompress_unzip.c +++ b/archival/libunarchive/decompress_unzip.c | |||
@@ -997,7 +997,7 @@ extern int unzip(FILE *l_in_file, FILE *l_out_file) | |||
997 | fread(buf, 1, 8, in_file); | 997 | fread(buf, 1, 8, in_file); |
998 | 998 | ||
999 | /* Validate decompression - crc */ | 999 | /* Validate decompression - crc */ |
1000 | if (((buf[0] | (buf[1] << 8)) |((buf[2] | (buf[3] << 8)) << 16)) != (crc ^ 0xffffffffL)) { | 1000 | if ((unsigned int)((buf[0] | (buf[1] << 8)) |((buf[2] | (buf[3] << 8)) << 16)) != (crc ^ 0xffffffffL)) { |
1001 | error_msg("invalid compressed data--crc error"); | 1001 | error_msg("invalid compressed data--crc error"); |
1002 | } | 1002 | } |
1003 | /* Validate decompression - size */ | 1003 | /* Validate decompression - size */ |
diff --git a/archival/libunarchive/unzip.c b/archival/libunarchive/unzip.c index 7de28930a..40b8af427 100644 --- a/archival/libunarchive/unzip.c +++ b/archival/libunarchive/unzip.c | |||
@@ -997,7 +997,7 @@ extern int unzip(FILE *l_in_file, FILE *l_out_file) | |||
997 | fread(buf, 1, 8, in_file); | 997 | fread(buf, 1, 8, in_file); |
998 | 998 | ||
999 | /* Validate decompression - crc */ | 999 | /* Validate decompression - crc */ |
1000 | if (((buf[0] | (buf[1] << 8)) |((buf[2] | (buf[3] << 8)) << 16)) != (crc ^ 0xffffffffL)) { | 1000 | if ((unsigned int)((buf[0] | (buf[1] << 8)) |((buf[2] | (buf[3] << 8)) << 16)) != (crc ^ 0xffffffffL)) { |
1001 | error_msg("invalid compressed data--crc error"); | 1001 | error_msg("invalid compressed data--crc error"); |
1002 | } | 1002 | } |
1003 | /* Validate decompression - size */ | 1003 | /* Validate decompression - size */ |