From e9e50fe2c6ebef9df7d5884afe2092c3fb12cb08 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 17 Dec 2025 16:09:12 +0000 Subject: [PATCH] Avoid pre-decrement of pointer in big-endian CRC calculation. --- .../Demonstrations/Watermark/lib/zlib-1.2.8/crc32.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Projects/32L4P5GDISCOVERY/Demonstrations/Watermark/lib/zlib-1.2.8/crc32.c b/Projects/32L4P5GDISCOVERY/Demonstrations/Watermark/lib/zlib-1.2.8/crc32.c index 730565e88..5ac41a21a 100644 --- a/Projects/32L4P5GDISCOVERY/Demonstrations/Watermark/lib/zlib-1.2.8/crc32.c +++ b/Projects/32L4P5GDISCOVERY/Demonstrations/Watermark/lib/zlib-1.2.8/crc32.c @@ -285,7 +285,7 @@ local unsigned long crc32_little(crc, buf, len) } /* ========================================================================= */ -#define DOBIG4 c ^= *++buf4; \ +#define DOBIG4 c ^= *buf4++; \ c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \ crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24] #define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4 @@ -307,7 +307,6 @@ local unsigned long crc32_big(crc, buf, len) } buf4 = (const z_crc_t FAR *)(const void FAR *)buf; - buf4--; while (len >= 32) { DOBIG32; len -= 32; @@ -316,7 +315,6 @@ local unsigned long crc32_big(crc, buf, len) DOBIG4; len -= 4; } - buf4++; buf = (const unsigned char FAR *)buf4; if (len) do {