From cde116d4cf8fd05a3d51bdbce219078f6aa0b5df Mon Sep 17 00:00:00 2001 From: Christopher Wellons Date: Thu, 12 Feb 2026 11:41:29 -0500 Subject: [PATCH] Unsigned left shift in zigzag8 in case of negative If v is negative, the left shift was undefined. --- lite_encoding.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lite_encoding.h b/lite_encoding.h index 5f6c061..c3da5e7 100644 --- a/lite_encoding.h +++ b/lite_encoding.h @@ -375,7 +375,7 @@ static inline uint8_t le_decode_symbol(le_stream *restrict s, le_model *restrict // ---------------------------------------------------------------------------------------------------------------------------- static inline uint8_t zigzag8_encode(int8_t v) { - return (uint8_t)((v << 1) ^ (v >> 7)); + return (uint8_t)(((uint8_t)v << 1) ^ (v >> 7)); } // ----------------------------------------------------------------------------------------------------------------------------