ff_convert_matrix: fix integer overflow
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 18 Oct 2012 19:51:04 +0000 (21:51 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 18 Oct 2012 19:51:04 +0000 (21:51 +0200)
Fixes CID608053
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/mpegvideo_enc.c

index 32e1772..d777072 100644 (file)
@@ -103,7 +103,7 @@ void ff_convert_matrix(DSPContext *dsp, int (*qmat)[64],
                  *           3444240 >= (1 << 36) / (x) >= 275 */
 
                 qmat[qscale][i] = (int)((UINT64_C(1) << (QMAT_SHIFT + 14)) /
-                                        (ff_aanscales[i] * qscale * quant_matrix[j]));
+                                        (ff_aanscales[i] * (int64_t)qscale * quant_matrix[j]));
             }
         } else {
             for (i = 0; i < 64; i++) {