Commit a76897e1 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/smacker: Fix integer overflows in pred[] in smka_decode_frame()

Fixes: signed integer overflow: -2147481503 + -32732 cannot be represented in type 'int'
Fixes: 17782/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SMACKAUD_fuzzer-5769672225456128

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpegSigned-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 8c693104
...@@ -746,7 +746,7 @@ static int smka_decode_frame(AVCodecContext *avctx, void *data, ...@@ -746,7 +746,7 @@ static int smka_decode_frame(AVCodecContext *avctx, void *data,
goto error; goto error;
} }
val |= h[3].values[res] << 8; val |= h[3].values[res] << 8;
pred[1] += sign_extend(val, 16); pred[1] += (unsigned)sign_extend(val, 16);
*samples++ = pred[1]; *samples++ = pred[1];
} else { } else {
if(vlc[0].table) if(vlc[0].table)
...@@ -769,7 +769,7 @@ static int smka_decode_frame(AVCodecContext *avctx, void *data, ...@@ -769,7 +769,7 @@ static int smka_decode_frame(AVCodecContext *avctx, void *data,
goto error; goto error;
} }
val |= h[1].values[res] << 8; val |= h[1].values[res] << 8;
pred[0] += sign_extend(val, 16); pred[0] += (unsigned)sign_extend(val, 16);
*samples++ = pred[0]; *samples++ = pred[0];
} }
} }
......
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