1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

avcodec/truemotion2: Fix integer overflow in tm2_decode_blocks()

Fixes: signed integer overflow: 255 + 2147483634 cannot be represented in type 'int'
Fixes: 13472/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUEMOTION2_fuzzer-5712444142387200

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2019-03-27 00:39:56 +01:00
parent a208c277f8
commit 0ad0533e91

View File

@ -837,7 +837,7 @@ static int tm2_decode_blocks(TM2Context *ctx, AVFrame *p)
dst = p->data[0]; dst = p->data[0];
for (j = 0; j < h; j++) { for (j = 0; j < h; j++) {
for (i = 0; i < w; i++) { for (i = 0; i < w; i++) {
int y = Y[i], u = U[i >> 1], v = V[i >> 1]; unsigned y = Y[i], u = U[i >> 1], v = V[i >> 1];
dst[3*i+0] = av_clip_uint8(y + v); dst[3*i+0] = av_clip_uint8(y + v);
dst[3*i+1] = av_clip_uint8(y); dst[3*i+1] = av_clip_uint8(y);
dst[3*i+2] = av_clip_uint8(y + u); dst[3*i+2] = av_clip_uint8(y + u);