X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fxan.c;h=1ccf164847bb70aa963534b399cebd84ac4bf720;hb=09100ccc14690a9d781f055642b5b880752ee636;hp=8b4ec82405c0790c13d90b92a4eee90adf1bc1fc;hpb=6c35f890678346ae91d318c17da84f1894e0c127;p=ffmpeg diff --git a/libavcodec/xan.c b/libavcodec/xan.c index 8b4ec82405c..1ccf164847b 100644 --- a/libavcodec/xan.c +++ b/libavcodec/xan.c @@ -131,7 +131,10 @@ static int xan_huffman_decode(uint8_t *dest, int dest_len, return ret; while (val != 0x16) { - unsigned idx = val - 0x17 + get_bits1(&gb) * byte; + unsigned idx; + if (get_bits_left(&gb) < 1) + return AVERROR_INVALIDDATA; + idx = val - 0x17 + get_bits1(&gb) * byte; if (idx >= 2 * byte) return AVERROR_INVALIDDATA; val = src[idx];