[FFmpeg-cvslog] avformat/rmdec: Use 64bit for intermediate for DEINT_ID_INT4

Michael Niedermayer git at videolan.org
Sat Oct 9 19:37:05 EEST 2021


ffmpeg | branch: release/3.4 | Michael Niedermayer <michael at niedermayer.cc> | Thu Apr 15 22:44:19 2021 +0200| [6715ea85c08e41eb5e29690b0d8eeeafd01645d8] | committer: Michael Niedermayer

avformat/rmdec: Use 64bit for intermediate for DEINT_ID_INT4

Fixes: runtime error: signed integer overflow: 65312 * 65535 cannot be represented in type 'int'
Fixes: 32832/clusterfuzz-testcase-minimized-ffmpeg_dem_RM_fuzzer-4817710040088576

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 e2c2872393f25253aa40861a9707934c4b83a3af)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavformat/rmdec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
index 9f5df91c86..0135f935af 100644
--- a/libavformat/rmdec.c
+++ b/libavformat/rmdec.c
@@ -272,9 +272,9 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb,
         case DEINT_ID_INT4:
             if (ast->coded_framesize > ast->audio_framesize ||
                 sub_packet_h <= 1 ||
-                ast->coded_framesize * sub_packet_h > (2 + (sub_packet_h & 1)) * ast->audio_framesize)
+                ast->coded_framesize * (uint64_t)sub_packet_h > (2 + (sub_packet_h & 1)) * ast->audio_framesize)
                 return AVERROR_INVALIDDATA;
-            if (ast->coded_framesize * sub_packet_h != 2*ast->audio_framesize) {
+            if (ast->coded_framesize * (uint64_t)sub_packet_h != 2*ast->audio_framesize) {
                 avpriv_request_sample(s, "mismatching interleaver parameters");
                 return AVERROR_INVALIDDATA;
             }



More information about the ffmpeg-cvslog mailing list