mirror of
https://github.com/google/brotli.git
synced 2026-07-08 17:56:58 +00:00
Negative array access on state->mtf for InverseMoveToFrontTransform #104
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @danielrh on GitHub (Apr 18, 2016).
When decoding quickfox_repeated.compressed
The local variable
indexcan start off zero, which will result in an access to s.mtf[-1]https://github.com/google/brotli/blob/master/dec/decode.c#L881
Since the previous variable in the struct is a 32 bit integer mtf_upper_bound, and usually little endian < 2^24, this generally results in a zero access.
I believe this could exhibit itself as an issue on big endian systems and could be undefined behavior nevertheless. I think it would be more intuitive to restructure the code to avoid out of bounds access.
@eustas commented on GitHub (Apr 18, 2016):
Hello, Daniel.
Thank you for your report. Actually, the value taken from negative index lives very shortly - it is overwritten by mtf[0] = value. Nevertheless, going to fix it soon.
@eustas commented on GitHub (Apr 29, 2016):
Fixed in PR #343