diff options
author | Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> | 2016-11-09 00:38:50 +0100 |
---|---|---|
committer | Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> | 2016-11-27 00:28:05 +0100 |
commit | 1499f65ad42a4f4519f27a7d3b01c55146ce2ad0 (patch) | |
tree | ece35815766d1d7175f215296da38f93d7871321 /libavcodec | |
parent | 6a7f0585ab195bb90ed2d3938633c4cd5fe4bc09 (diff) | |
download | ffmpeg-1499f65ad42a4f4519f27a7d3b01c55146ce2ad0.tar.gz |
escape124: reject codebook size 0
It causes a cb_depth of 32, leading to assertion failures in get_bits.
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
(cherry picked from commit 226d35c84591f1901c2a13819031549909faa1f5)
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/escape124.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/escape124.c b/libavcodec/escape124.c index 9a51bdaa9c..71e22779f6 100644 --- a/libavcodec/escape124.c +++ b/libavcodec/escape124.c @@ -250,6 +250,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); |