]> git.sesse.net Git - ffmpeg/commitdiff
avformat/rmdec: use larger intermediate type for audio_framesize * sub_packet_h check
authorMichael Niedermayer <michael@niedermayer.cc>
Tue, 30 Mar 2021 09:03:56 +0000 (11:03 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 1 Apr 2021 08:10:21 +0000 (10:10 +0200)
Fixes: signed integer overflow: 65535 * 65535 cannot be represented in type 'int'
Fixes: 31406/clusterfuzz-testcase-minimized-ffmpeg_dem_IVR_fuzzer-5024692843970560
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/rmdec.c

index 610189ecb40346502985f5a35c68f197bdd7424a..b6f42183e8e19b6c080480ccd325144d3715fede 100644 (file)
@@ -296,7 +296,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb,
             ast->deint_id == DEINT_ID_GENR ||
             ast->deint_id == DEINT_ID_SIPR) {
             if (st->codecpar->block_align <= 0 ||
-                ast->audio_framesize * sub_packet_h > (unsigned)INT_MAX ||
+                ast->audio_framesize * (uint64_t)sub_packet_h > (unsigned)INT_MAX ||
                 ast->audio_framesize * sub_packet_h < st->codecpar->block_align)
                 return AVERROR_INVALIDDATA;
             if (av_new_packet(&ast->pkt, ast->audio_framesize * sub_packet_h) < 0)