]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/truemotion2: fix integer overflows in tm2_low_chroma()
authorMichael Niedermayer <michael@niedermayer.cc>
Fri, 16 Nov 2018 23:38:53 +0000 (00:38 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Sat, 24 Nov 2018 21:12:10 +0000 (22:12 +0100)
Fixes: 11295/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUEMOTION2_fuzzer-4888953459572736
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 6d58483a7772abcb973f807ca00d2e4f549e5103..4d27f0cbfc5e1a910cea4d4f703a36fdd2e48b10 100644 (file)
@@ -493,7 +493,7 @@ static inline void tm2_high_chroma(int *data, int stride, int *last, unsigned *C
     }
 }
 
-static inline void tm2_low_chroma(int *data, int stride, int *clast, int *CD, int *deltas, int bx)
+static inline void tm2_low_chroma(int *data, int stride, int *clast, unsigned *CD, int *deltas, int bx)
 {
     int t;
     int l;
@@ -503,8 +503,8 @@ static inline void tm2_low_chroma(int *data, int stride, int *clast, int *CD, in
         prev = clast[-3];
     else
         prev = 0;
-    t        = (CD[0] + CD[1]) >> 1;
-    l        = (prev - CD[0] - CD[1] + clast[1]) >> 1;
+    t        = (int)(CD[0] + CD[1]) >> 1;
+    l        = (int)(prev - CD[0] - CD[1] + clast[1]) >> 1;
     CD[1]    = CD[0] + CD[1] - t;
     CD[0]    = t;
     clast[0] = l;