aboutsummaryrefslogtreecommitdiff
path: root/zlib.h
diff options
context:
space:
mode:
authorMark Adler <git@madler.net>2025-12-21 18:17:56 -0800
committerMark Adler <git@madler.net>2026-01-05 15:03:04 -0600
commitba829a458576d1ff0f26fc7230c6de816d1f6a77 (patch)
treeb955e6951991dbb4aed9c556a6f2b28645ca95fb /zlib.h
parent570720b0c24f9686c33f35a1b3165c1f568b96be (diff)
downloadzlib-ba829a458576d1ff0f26fc7230c6de816d1f6a77.tar.gz
zlib-ba829a458576d1ff0f26fc7230c6de816d1f6a77.tar.bz2
zlib-ba829a458576d1ff0f26fc7230c6de816d1f6a77.zip
Check for negative lengths in crc32_combine functions.
Though zlib.h says that len2 must be non-negative, this avoids the possibility of an accidental infinite loop.
Diffstat (limited to 'zlib.h')
-rw-r--r--zlib.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/zlib.h b/zlib.h
index f7aded9a..2881da71 100644
--- a/zlib.h
+++ b/zlib.h
@@ -1848,14 +1848,14 @@ ZEXTERN uLong ZEXPORT crc32_combine(uLong crc1, uLong crc2, z_off_t len2);
1848 seq1 and seq2 with lengths len1 and len2, CRC-32 check values were 1848 seq1 and seq2 with lengths len1 and len2, CRC-32 check values were
1849 calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 1849 calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32
1850 check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and 1850 check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and
1851 len2. len2 must be non-negative. 1851 len2. len2 must be non-negative, otherwise zero is returned.
1852*/ 1852*/
1853 1853
1854/* 1854/*
1855ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t len2); 1855ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t len2);
1856 1856
1857 Return the operator corresponding to length len2, to be used with 1857 Return the operator corresponding to length len2, to be used with
1858 crc32_combine_op(). len2 must be non-negative. 1858 crc32_combine_op(). len2 must be non-negative, otherwise zero is returned.
1859*/ 1859*/
1860 1860
1861ZEXTERN uLong ZEXPORT crc32_combine_op(uLong crc1, uLong crc2, uLong op); 1861ZEXTERN uLong ZEXPORT crc32_combine_op(uLong crc1, uLong crc2, uLong op);