]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/diracdec: Fix integer overflow in mv computation
authorMichael Niedermayer <michael@niedermayer.cc>
Sun, 18 Feb 2018 20:51:38 +0000 (21:51 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Tue, 20 Feb 2018 14:27:51 +0000 (15:27 +0100)
Fixes: signed integer overflow: -2072 + -2147483646 cannot be represented in type 'int'
Fixes: 6097/clusterfuzz-testcase-minimized-5034145253163008
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/diracdec.c

index e3afbf14be1849173b8a2ea01a4a16a7614350f0..753adeff61ce8362c31159d7cbb9714931e5663c 100644 (file)
@@ -1437,8 +1437,8 @@ static void decode_block_params(DiracContext *s, DiracArith arith[8], DiracBlock
                 global_mv(s, block, x, y, i);
             } else {
                 pred_mv(block, stride, x, y, i);
-                block->u.mv[i][0] += dirac_get_arith_int(arith + 4 + 2 * i, CTX_MV_F1, CTX_MV_DATA);
-                block->u.mv[i][1] += dirac_get_arith_int(arith + 5 + 2 * i, CTX_MV_F1, CTX_MV_DATA);
+                block->u.mv[i][0] += (unsigned)dirac_get_arith_int(arith + 4 + 2 * i, CTX_MV_F1, CTX_MV_DATA);
+                block->u.mv[i][1] += (unsigned)dirac_get_arith_int(arith + 5 + 2 * i, CTX_MV_F1, CTX_MV_DATA);
             }
         }
 }