]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/diracdec: Use 64bit in intermediate of global motion vector field generation
authorMichael Niedermayer <michael@niedermayer.cc>
Sun, 7 Apr 2019 14:44:53 +0000 (16:44 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Fri, 19 Apr 2019 19:06:09 +0000 (21:06 +0200)
It seems the specification does not limit the value to 32bit

Fixes: signed integer overflow: -109611143 * 24 cannot be represented in type 'int'
Fixes: 13477/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DIRAC_fuzzer-5648337460527104
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/diracdec.c

index a1e759f6563c8c0a4fc2d294245b842eeeca0fae..a5bb6d5f3441b224f6a60ac124af3330ed5f3eae 100644 (file)
@@ -1432,7 +1432,7 @@ static void global_mv(DiracContext *s, DiracBlock *block, int x, int y, int ref)
     int *b      = s->globalmc[ref].pan_tilt;
     int *c      = s->globalmc[ref].perspective;
 
-    int m       = (1<<ep) - (c[0]*x + c[1]*y);
+    int64_t m   = (1<<ep) - (c[0]*(int64_t)x + c[1]*(int64_t)y);
     int64_t mx  = m * (int64_t)((A[0][0] * (int64_t)x + A[0][1]*(int64_t)y) + (1<<ez) * b[0]);
     int64_t my  = m * (int64_t)((A[1][0] * (int64_t)x + A[1][1]*(int64_t)y) + (1<<ez) * b[1]);