diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2019-05-05 00:31:24 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2020-07-01 12:11:55 +0200 |
commit | deaa56a0555078a9557e29502d4c1cb36736e6cc (patch) | |
tree | dccf22c0c8d06ddc952f654f23d5d3d25bf596aa | |
parent | 9f8f52f35b6e2624223b383fe6d19780db62f86d (diff) | |
download | ffmpeg-deaa56a0555078a9557e29502d4c1cb36736e6cc.tar.gz |
avcodec/truemotion2: Fix several integer overflows in tm2_update_block()
Fixes: signed integer overflow: -1877966852 + -469491713 cannot be represented in type 'int'
Fixes: 14561/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUEMOTION2_fuzzer-5167608359288832
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 8eecf761a65baf4ce6f25c0a149819cc9414c0f0)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/truemotion2.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libavcodec/truemotion2.c b/libavcodec/truemotion2.c index b0a6935b0d..d59095622d 100644 --- a/libavcodec/truemotion2.c +++ b/libavcodec/truemotion2.c @@ -688,15 +688,15 @@ static inline void tm2_update_block(TM2Context *ctx, AVFrame *pic, int bx, int b TM2_RECALC_BLOCK(V, Vstride, (clast + 2), (ctx->CD + 2)); /* update deltas */ - ctx->D[0] = Yo[3] - last[3]; - ctx->D[1] = Yo[3 + oYstride] - Yo[3]; - ctx->D[2] = Yo[3 + oYstride * 2] - Yo[3 + oYstride]; - ctx->D[3] = Yo[3 + oYstride * 3] - Yo[3 + oYstride * 2]; + ctx->D[0] = (unsigned)Yo[3] - last[3]; + ctx->D[1] = (unsigned)Yo[3 + oYstride] - Yo[3]; + ctx->D[2] = (unsigned)Yo[3 + oYstride * 2] - Yo[3 + oYstride]; + ctx->D[3] = (unsigned)Yo[3 + oYstride * 3] - Yo[3 + oYstride * 2]; for (j = 0; j < 4; j++) { d = last[3]; for (i = 0; i < 4; i++) { - Y[i] = Yo[i] + GET_TOK(ctx, TM2_UPD); + Y[i] = Yo[i] + (unsigned)GET_TOK(ctx, TM2_UPD); last[i] = Y[i]; } ctx->D[j] = last[3] - d; |