diff options
author | Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> | 2015-12-16 18:48:19 +0300 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2016-01-13 11:33:09 +0300 |
commit | 2884cf205a9a29d89db7a444c5b1613cdfe37acf (patch) | |
tree | f440a098ff6bce0fa95b4a5205fc5aa397c4e8c8 /libavcodec/on2avc.c | |
parent | c59fec783d6540dd96540b079d753ee4a6ad2e58 (diff) |
on2avc: limit number of bits to 30 in get_egolomb
More don't fit into the integer output.
Also use get_bits_long, since get_bits only supports reading up to 25
bits, while get_bits_long supports the full integer range.
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libavcodec/on2avc.c')
-rw-r--r-- | libavcodec/on2avc.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/libavcodec/on2avc.c b/libavcodec/on2avc.c index 3f531bc83b..3918365a01 100644 --- a/libavcodec/on2avc.c +++ b/libavcodec/on2avc.c @@ -211,9 +211,16 @@ static inline int get_egolomb(GetBitContext *gb) { int v = 4; - while (get_bits1(gb)) v++; + while (get_bits1(gb)) { + v++; + if (v > 30) { + av_log(NULL, AV_LOG_WARNING, "Too large golomb code in get_egolomb.\n"); + v = 30; + break; + } + } - return (1 << v) + get_bits(gb, v); + return (1 << v) + get_bits_long(gb, v); } static int on2avc_decode_pairs(On2AVCContext *c, GetBitContext *gb, float *dst, |