atomicobject / heatshrink

data compression library for embedded/real-time systems
ISC License
1.31k stars 176 forks source link

Fix indexing integer overflow for 15-bit window #88

Open sameer opened 3 months ago

sameer commented 3 months ago

Partly addresses #86

A 15-bit window with a filled input buffer can result in an integer overflow in do_indexing. This PR addresses the problem by making the end bound inclusive.

One solution I came up with to actually get indexing to work for a 15-bit window was to make the index an unsigned 16-bit integer array with 0xFFFF representing end-of-list.