Commit b2955b6c authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/rangecoder: Check e

Fixes hang.nut
Found-by: 's avatarPaul B Mahol <onemda@gmail.com>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 9458a62d
...@@ -47,8 +47,11 @@ static inline av_flatten int get_symbol_inline(RangeCoder *c, uint8_t *state, ...@@ -47,8 +47,11 @@ static inline av_flatten int get_symbol_inline(RangeCoder *c, uint8_t *state,
else { else {
int i, e, a; int i, e, a;
e = 0; 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++; e++;
if (e > 31)
return AVERROR_INVALIDDATA;
}
a = 1; a = 1;
for (i = e - 1; i >= 0; i--) for (i = e - 1; i >= 0; i--)
......
...@@ -564,6 +564,8 @@ static inline int get_symbol(RangeCoder *c, uint8_t *state, int is_signed){ ...@@ -564,6 +564,8 @@ static inline int get_symbol(RangeCoder *c, uint8_t *state, int is_signed){
e= 0; 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++; e++;
if (e > 31)
return AVERROR_INVALIDDATA;
} }
a= 1; a= 1;
......
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