From f50ace36c79e00bec18fddf81e30c0f5a41defa0 Mon Sep 17 00:00:00 2001 From: Sameer Puri Date: Sun, 19 May 2024 02:38:23 -0400 Subject: [PATCH] Fix indexing integer overflow for 15-bit window --- heatshrink_encoder.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/heatshrink_encoder.c b/heatshrink_encoder.c index edf4abe..d92ea70 100644 --- a/heatshrink_encoder.c +++ b/heatshrink_encoder.c @@ -425,9 +425,9 @@ static void do_indexing(heatshrink_encoder *hse) { int16_t * const index = hsi->index; const uint16_t input_offset = get_input_offset(hse); - const uint16_t end = input_offset + hse->input_size; + const uint16_t end = (input_offset - 1) + hse->input_size; - for (uint16_t i=0; i