diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2019-10-26 21:39:41 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2020-07-01 12:49:26 +0200 |
commit | e7f409662cca18e7ee9108e0bd0867ba50f59de5 (patch) | |
tree | 9bd72f8057d4d345deab7fbdd282ef92d7a3570a | |
parent | f640a2d9a97e94e0f5652905c405430f3dd0bc33 (diff) | |
download | ffmpeg-e7f409662cca18e7ee9108e0bd0867ba50f59de5.tar.gz |
avcodec/truemotion2: Fix several integer overflows in tm2_low_res_block()
Fixes: signed integer overflow: 1077952576 + 1355863565 cannot be represented in type 'int'
Fixes: 16196/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUEMOTION2_fuzzer-5679842317565952
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 2b655f55eaf09eb99b5e694dba2c0cf73fa2c646)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/truemotion2.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libavcodec/truemotion2.c b/libavcodec/truemotion2.c index 80a28a0ac6..1c9e9a93d8 100644 --- a/libavcodec/truemotion2.c +++ b/libavcodec/truemotion2.c @@ -568,10 +568,10 @@ static inline void tm2_low_res_block(TM2Context *ctx, AVFrame *pic, int bx, int deltas[10] = GET_TOK(ctx, TM2_L_LO); if (bx > 0) - last[0] = (last[-1] - ctx->D[0] - ctx->D[1] - ctx->D[2] - ctx->D[3] + last[1]) >> 1; + last[0] = (int)((unsigned)last[-1] - ctx->D[0] - ctx->D[1] - ctx->D[2] - ctx->D[3] + last[1]) >> 1; else - last[0] = (last[1] - ctx->D[0] - ctx->D[1] - ctx->D[2] - ctx->D[3])>> 1; - last[2] = (last[1] + last[3]) >> 1; + last[0] = (int)((unsigned)last[1] - ctx->D[0] - ctx->D[1] - ctx->D[2] - ctx->D[3])>> 1; + last[2] = (int)((unsigned)last[1] + last[3]) >> 1; t1 = ctx->D[0] + ctx->D[1]; ctx->D[0] = t1 >> 1; |