]> git.ipfire.org Git - thirdparty/zstd.git/commit
[huf] Fix bug in fast C decoders
authorNick Terrell <terrelln@fb.com>
Thu, 26 Jan 2023 20:11:25 +0000 (12:11 -0800)
committerNick Terrell <nickrterrell@gmail.com>
Thu, 26 Jan 2023 22:39:13 +0000 (14:39 -0800)
commitbda947e17a61b9f7434ea878dff04a409a2ff772
treeba8c33722721d79cbf6dd4161e7f82fbf50014d0
parent7b3f03bc9dea0ca04d53e28905caafbfa25d331d
[huf] Fix bug in fast C decoders

The input bounds checks were buggy because they were only breaking from
the inner loop, not the outer loop. The fuzzers found this immediately.
The fix is to use `goto _out` instead of `break`.

This condition can happen on corrupted inputs.

I've benchmarked before and after on x86-64 and there were small changes
in performance, some positive, and some negative, and they end up about
balacing out.

Credit to  OSS-Fuzz
lib/decompress/huf_decompress.c