atomicobject / heatshrink

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

off-by-one in assert in st_step_search / st_yield_backref ? #36

Closed timothyzillion closed 8 years ago

timothyzillion commented 8 years ago

When running with asserts enabled I hit one of them during encode:

https://github.com/atomicobject/heatshrink/blob/master/heatshrink_encoder.c#L297

matching assert in the decoder here:

https://github.com/atomicobject/heatshrink/blob/master/heatshrink_decoder.c#L272

**

Assertion failed: (match_pos < 1 << ((hse)->window_sz2)), function st_step_search

should the encoder-assertion be "(match_pos <= 1 << ((hse)->window_sz2))" instead ?

and the decoder-assertion be "ASSERT(neg_offset <= mask + 1)"

silentbicycle commented 8 years ago

This was fixed by 060f120a8c114f5f7aa5c0758fca2283bcd552a3 and should have been closed. Thanks for reporting it.