diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2019-07-08 23:00:09 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2020-07-01 12:11:55 +0200 |
commit | af988e8b8d8775b7010d9bf3914f3e3d40d42ab9 (patch) | |
tree | d1c59b71951bfeba861aca384e66df12abb96333 | |
parent | 97b4a01596c37dc3fa2c646afe8e3c2be9ba07cd (diff) | |
download | ffmpeg-af988e8b8d8775b7010d9bf3914f3e3d40d42ab9.tar.gz |
avcodec/truemotion2: Fix several integer overflows in tm2_motion_block()
Fixes: 15524/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUEMOTION2_fuzzer-5173148372172800
Fixes: signed integer overflow: 13701388 - -2134868270 cannot be represented in type 'int'
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 9a353ea8766206bd302f3f12ca1d226237542908)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/truemotion2.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libavcodec/truemotion2.c b/libavcodec/truemotion2.c index 4e3a429777..3443bbeda2 100644 --- a/libavcodec/truemotion2.c +++ b/libavcodec/truemotion2.c @@ -751,10 +751,10 @@ static inline void tm2_motion_block(TM2Context *ctx, AVFrame *pic, int bx, int b } /* calculate deltas */ Y -= Ystride * 4; - ctx->D[0] = Y[3] - last[3]; - ctx->D[1] = Y[3 + Ystride] - Y[3]; - ctx->D[2] = Y[3 + Ystride * 2] - Y[3 + Ystride]; - ctx->D[3] = Y[3 + Ystride * 3] - Y[3 + Ystride * 2]; + ctx->D[0] = (unsigned)Y[3] - last[3]; + ctx->D[1] = (unsigned)Y[3 + Ystride] - Y[3]; + ctx->D[2] = (unsigned)Y[3 + Ystride * 2] - Y[3 + Ystride]; + ctx->D[3] = (unsigned)Y[3 + Ystride * 3] - Y[3 + Ystride * 2]; for (i = 0; i < 4; i++) last[i] = Y[i + Ystride * 3]; } |