[FFmpeg-cvslog] avcodec/vc1_block: Fix integer overflow in AC rescaling in vc1_decode_i_block_adv()

Michael Niedermayer git at videolan.org
Sun Dec 1 19:57:07 EET 2019


ffmpeg | branch: release/3.4 | Michael Niedermayer <michael at niedermayer.cc> | Fri Nov  8 18:31:02 2019 +0100| [5b43aa7a80f5ddaa46fec9866061a7c0e0d7f72e] | committer: Michael Niedermayer

avcodec/vc1_block: Fix integer overflow in AC rescaling in vc1_decode_i_block_adv()

Fixes: signed integer overflow: 50176 * 262144 cannot be represented in type 'int'
Fixes: 18629/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1IMAGE_fuzzer-5182370286403584

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 0e010e489b70c044a67c47083cf8eb03209ee89f)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5b43aa7a80f5ddaa46fec9866061a7c0e0d7f72e
---

 libavcodec/vc1_block.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/vc1_block.c b/libavcodec/vc1_block.c
index b4a674978f..976d330935 100644
--- a/libavcodec/vc1_block.c
+++ b/libavcodec/vc1_block.c
@@ -867,7 +867,7 @@ static int vc1_decode_i_block_adv(VC1Context *v, int16_t block[64], int n,
                 if (q1 < 1)
                     return AVERROR_INVALIDDATA;
                 for (k = 1; k < 8; k++)
-                    ac_val2[k] = (ac_val2[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18;
+                    ac_val2[k] = (int)(ac_val2[k] * q2 * (unsigned)ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18;
             }
             for (k = 1; k < 8; k++) {
                 block[k << sh] = ac_val2[k] * scale;



More information about the ffmpeg-cvslog mailing list