Note that the len2 argument of crc_combine*() must be non-negative.

If it is negative, then the code will enter an infinite loop.
This commit is contained in:
Mark Adler 2024-01-11 12:53:58 -08:00
parent 60c31985ec
commit 36e369e1a5
1 changed files with 2 additions and 2 deletions

4
zlib.h
View File

@ -1758,14 +1758,14 @@ ZEXTERN uLong ZEXPORT crc32_combine(uLong crc1, uLong crc2, z_off_t len2);
seq1 and seq2 with lengths len1 and len2, CRC-32 check values were seq1 and seq2 with lengths len1 and len2, CRC-32 check values were
calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32
check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and
len2. len2. len2 must be non-negative.
*/ */
/* /*
ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t len2); ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t len2);
Return the operator corresponding to length len2, to be used with Return the operator corresponding to length len2, to be used with
crc32_combine_op(). crc32_combine_op(). len2 must be non-negative.
*/ */
ZEXTERN uLong ZEXPORT crc32_combine_op(uLong crc1, uLong crc2, uLong op); ZEXTERN uLong ZEXPORT crc32_combine_op(uLong crc1, uLong crc2, uLong op);