Commit 226d35c8 authored by Andreas Cadhalpun's avatar Andreas Cadhalpun

escape124: reject codebook size 0

It causes a cb_depth of 32, leading to assertion failures in get_bits.
Reviewed-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
Signed-off-by: 's avatarAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
parent d54c95a1
......@@ -249,6 +249,10 @@ static int escape124_decode_frame(AVCodecContext *avctx,
// This codebook can be cut off at places other than
// powers of 2, leaving some of the entries undefined.
cb_size = get_bits_long(&gb, 20);
if (!cb_size) {
av_log(avctx, AV_LOG_ERROR, "Invalid codebook size 0.\n");
return AVERROR_INVALIDDATA;
}
cb_depth = av_log2(cb_size - 1) + 1;
} else {
cb_depth = get_bits(&gb, 4);
......
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