]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Fixed UB in adler32_avx512_copy storemask when len is 0.
authorNathan Moinvaziri <nathan@nathanm.com>
Sun, 11 Jan 2026 00:13:54 +0000 (16:13 -0800)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Tue, 13 Jan 2026 17:43:50 +0000 (18:43 +0100)
arch/x86/adler32_avx512.c

index 8ebaf50b2c7d44c94315da86c61e96643315ee82..545806bfc53d1f2654e4386c1e9e3dab7942588b 100644 (file)
@@ -26,7 +26,7 @@ Z_FORCEINLINE static uint32_t adler32_copy_impl(uint32_t adler, uint8_t *dst, co
 rem_peel:
     if (len < 64) {
         /* This handles the remaining copies, just call normal adler checksum after this */
-        if (COPY) {
+        if (COPY && len) {
             __mmask64 storemask = (0xFFFFFFFFFFFFFFFFUL >> (64 - len));
             __m512i copy_vec = _mm512_maskz_loadu_epi8(storemask, src);
             _mm512_mask_storeu_epi8(dst, storemask, copy_vec);