Fix a type promotion bug discivered and analyzed by Alan Modra

<amodra@bigpond.net.au>, which caused false checksum errors
This commit is contained in:
Eric Andersen 2001-06-27 06:15:50 +00:00
parent 4b6b5e4314
commit 0d8cc1670c
3 changed files with 3 additions and 3 deletions

View File

@ -997,7 +997,7 @@ extern int unzip(FILE *l_in_file, FILE *l_out_file)
fread(buf, 1, 8, in_file);
/* Validate decompression - crc */
if (((buf[0] | (buf[1] << 8)) |((buf[2] | (buf[3] << 8)) << 16)) != (crc ^ 0xffffffffL)) {
if ((unsigned int)((buf[0] | (buf[1] << 8)) |((buf[2] | (buf[3] << 8)) << 16)) != (crc ^ 0xffffffffL)) {
error_msg("invalid compressed data--crc error");
}
/* Validate decompression - size */

View File

@ -997,7 +997,7 @@ extern int unzip(FILE *l_in_file, FILE *l_out_file)
fread(buf, 1, 8, in_file);
/* Validate decompression - crc */
if (((buf[0] | (buf[1] << 8)) |((buf[2] | (buf[3] << 8)) << 16)) != (crc ^ 0xffffffffL)) {
if ((unsigned int)((buf[0] | (buf[1] << 8)) |((buf[2] | (buf[3] << 8)) << 16)) != (crc ^ 0xffffffffL)) {
error_msg("invalid compressed data--crc error");
}
/* Validate decompression - size */

View File

@ -997,7 +997,7 @@ extern int unzip(FILE *l_in_file, FILE *l_out_file)
fread(buf, 1, 8, in_file);
/* Validate decompression - crc */
if (((buf[0] | (buf[1] << 8)) |((buf[2] | (buf[3] << 8)) << 16)) != (crc ^ 0xffffffffL)) {
if ((unsigned int)((buf[0] | (buf[1] << 8)) |((buf[2] | (buf[3] << 8)) << 16)) != (crc ^ 0xffffffffL)) {
error_msg("invalid compressed data--crc error");
}
/* Validate decompression - size */