aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/on2avc.c
diff options
context:
space:
mode:
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2015-12-16 16:48:19 +0100
committerAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2015-12-18 15:29:57 +0100
commit4d5c3b02e9d2c9a630ca433fabca43285879e0b8 (patch)
tree6d8905878be2b95380406d4dbe34b340ace2b896 /libavcodec/on2avc.c
parent4386f17bbdf79d19339ab8434b15109dedfb9551 (diff)
downloadffmpeg-4d5c3b02e9d2c9a630ca433fabca43285879e0b8.tar.gz
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. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Diffstat (limited to 'libavcodec/on2avc.c')
-rw-r--r--libavcodec/on2avc.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/libavcodec/on2avc.c b/libavcodec/on2avc.c
index 15f4dd1c66..04c8e410a8 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,