From: Nathan Moinvaziri Date: Sun, 11 Jan 2026 00:13:54 +0000 (-0800) Subject: Fixed UB in adler32_avx512_copy storemask when len is 0. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a17bae48614ea02f6a2abdacd3f293a5f0740338;p=thirdparty%2Fzlib-ng.git Fixed UB in adler32_avx512_copy storemask when len is 0. --- diff --git a/arch/x86/adler32_avx512.c b/arch/x86/adler32_avx512.c index 8ebaf50b2..545806bfc 100644 --- a/arch/x86/adler32_avx512.c +++ b/arch/x86/adler32_avx512.c @@ -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);