]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/truemotion2: Fix multiple integer overflows in tm2_null_res_block()
authorMichael Niedermayer <michael@niedermayer.cc>
Thu, 15 Aug 2019 21:22:50 +0000 (23:22 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sat, 31 Aug 2019 16:34:05 +0000 (18:34 +0200)
Fixes: signed integer overflow: 1795032576 + 598344192 cannot be represented in type 'int'
Fixes: 16196/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUEMOTION2_fuzzer-5636723419119616
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/truemotion2.c

index 5d6dfc24c395faae71aabe9ff795bf25446c8610..27c876fd7de01493ab541cb17bb645c9a2e403f2 100644 (file)
@@ -619,7 +619,7 @@ static inline void tm2_null_res_block(TM2Context *ctx, AVFrame *pic, int bx, int
     ct = ctx->D[0] + ctx->D[1] + ctx->D[2] + ctx->D[3];
 
     if (bx > 0)
-        left = last[-1] - ct;
+        left = last[-1] - (unsigned)ct;
     else
         left = 0;
 
@@ -630,7 +630,7 @@ static inline void tm2_null_res_block(TM2Context *ctx, AVFrame *pic, int bx, int
     last[2] = right - (diff >> 2);
     last[3] = right;
     {
-        int tp = left;
+        unsigned tp = left;
 
         ctx->D[0] = (tp + (ct >> 2)) - left;
         left     += ctx->D[0];