diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2015-09-25 14:26:14 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2015-12-06 12:40:49 +0100 |
commit | b5b29b22c0f8b49db045edb33254291486cb0db7 (patch) | |
tree | e8162ec37d1ad9b2d677ab54b34cbcdac3268abb | |
parent | c6769b6d56bea1548a1c0167fdc322991bd46e50 (diff) | |
download | ffmpeg-b5b29b22c0f8b49db045edb33254291486cb0db7.tar.gz |
avcodec/rangecoder: Check e
Fixes hang.nut
Found-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit b2955b6c5aed11026ec5c7164462899a10cdb937)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/ffv1dec.c | 5 | ||||
-rw-r--r-- | libavcodec/snow.h | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c index 760d74faf7..26ed2eeddc 100644 --- a/libavcodec/ffv1dec.c +++ b/libavcodec/ffv1dec.c @@ -47,8 +47,11 @@ static inline av_flatten int get_symbol_inline(RangeCoder *c, uint8_t *state, else { int i, e, a; e = 0; - while (get_rac(c, state + 1 + FFMIN(e, 9))) // 1..10 + while (get_rac(c, state + 1 + FFMIN(e, 9))) { // 1..10 e++; + if (e > 31) + return AVERROR_INVALIDDATA; + } a = 1; for (i = e - 1; i >= 0; i--) diff --git a/libavcodec/snow.h b/libavcodec/snow.h index 46df46c5c8..d2fcc7c375 100644 --- a/libavcodec/snow.h +++ b/libavcodec/snow.h @@ -555,6 +555,8 @@ static inline int get_symbol(RangeCoder *c, uint8_t *state, int is_signed){ e= 0; while(get_rac(c, state+1 + FFMIN(e,9))){ //1..10 e++; + if (e > 31) + return AVERROR_INVALIDDATA; } a= 1; |