Commit 0c433084 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/ralf: Fix integer overflow in decode_block()

Fixes: signed integer overflow: 289082077 - -2003141111 cannot be represented in type 'int'
Fixes: 20492/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RALF_fuzzer-5196077752123392

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpegSigned-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 1ac106bf
......@@ -344,7 +344,8 @@ static int decode_block(AVCodecContext *avctx, GetBitContext *gb,
int len, ch, ret;
int dmode, mode[2], bits[2];
int *ch0, *ch1;
int i, t, t2;
int i;
unsigned int t, t2;
len = 12 - get_unary(gb, 0, 6);
......@@ -409,8 +410,8 @@ static int decode_block(AVCodecContext *avctx, GetBitContext *gb,
for (i = 0; i < len; i++) {
t = ch1[i] + ctx->bias[1];
t2 = ((ch0[i] + ctx->bias[0]) * 2) | (t & 1);
dst0[i] = (t2 + t) / 2;
dst1[i] = (t2 - t) / 2;
dst0[i] = (int)(t2 + t) / 2;
dst1[i] = (int)(t2 - t) / 2;
}
break;
}
......
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