Commit 9ebe6e39 authored by Michael Niedermayer's avatar Michael Niedermayer

ffv1: fix integer overflow in quant table initialization

Fixes part of Ticket1372
Found-by: 's avatarPiotr Bandurski <ami_stuff@o2.pl>
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 97c281d5
...@@ -1651,9 +1651,9 @@ static int read_quant_table(RangeCoder *c, int16_t *quant_table, int scale){ ...@@ -1651,9 +1651,9 @@ static int read_quant_table(RangeCoder *c, int16_t *quant_table, int scale){
memset(state, 128, sizeof(state)); memset(state, 128, sizeof(state));
for(v=0; i<128 ; v++){ for(v=0; i<128 ; v++){
int len= get_symbol(c, state, 0) + 1; unsigned len= get_symbol(c, state, 0) + 1;
if(len + i > 128) return -1; if(len > 128 - i) return -1;
while(len--){ while(len--){
quant_table[i] = scale*v; quant_table[i] = scale*v;
......
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