Commit 5d64e715 authored by Hubert Figuiere's avatar Hubert Figuiere
Browse files

Fix an overflow in the ljpeg decompressor

parent 176f7ace
......@@ -668,7 +668,9 @@ static const int32_t extendOffset[16] = /* entry n is (-1 << n) + 1 */
inline
void HuffExtend(int32_t & x, int32_t s) noexcept
{
if ((x) < extendTest[s]) {
// s >= 16 is an overflow. And probably will lead to a corrupt
// output but at least not crash.
if (s < 16 && x < extendTest[s]) {
(x) += extendOffset[s];
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment