Cyan4973 / FiniteStateEntropy

New generation entropy codecs : Finite State Entropy and Huff0
BSD 2-Clause "Simplified" License
1.33k stars 143 forks source link

Negative index into stateTable? #113

Open chhu opened 1 year ago

chhu commented 1 year ago

This is more a question: How can you guarantee that this index to stateTable cannot become negative?

https://github.com/Cyan4973/FiniteStateEntropy/blob/7149fa45ec69f54a709e5260e6a0eeb27e710ee0/lib/fse.h#L520

Thanks!

madMAx43v3r commented 11 months ago

I've gotten segfaults here as well, usually when using more than 128 symbols.

I changed the code to check for out of range index and throw an exception.