]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
crc32: zero initialize chorba bitbuffer
authorcl2t <cl_2@outlook.com>
Sat, 14 Mar 2026 03:36:16 +0000 (11:36 +0800)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Tue, 14 Apr 2026 12:57:37 +0000 (14:57 +0200)
arch/generic/crc32_chorba_c.c

index 693972da1182f56fe040191fe1cbb00b6b4abf32..7fbe55ae24bbe4925ed471dcae1ffb10c8d58f22 100644 (file)
@@ -75,6 +75,10 @@ Z_INTERNAL uint32_t crc32_chorba_118960_nondestructive(uint32_t crc, const uint8
     chorba_word_t next22 = 0;
     crc = 0;
 
+    /* Make the temporary state explicitly zero-initialized so later XOR updates
+     * do not depend on the compiler inferring the staged write coverage. */
+    memset(bitbuffer, 0, bitbuffer_size_bytes);
+
     // do a first pass to zero out bitbuffer
     for (; i < (14848 * sizeof(chorba_word_t)); i += (32 * sizeof(chorba_word_t))) {
         chorba_word_t in1, in2, in3, in4, in5, in6, in7, in8;