aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-08-16 18:05:34 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-02-02 14:18:21 +0100
commit69d0cd7883ae861ad5359413840d597bbbd9ee32 (patch)
treeb0cbf1478af2bd1ec202f5cd0c89911e0ff2fd9a
parent9b6d73a9ae9c4b1ce0b44957fca90ab3b2d1041b (diff)
downloadffmpeg-69d0cd7883ae861ad5359413840d597bbbd9ee32.tar.gz
avformat/rmdec: sanity check coded_framesize
Fixes: signed integer overflow: -14671840 * 8224 cannot be represented in type 'int' Fixes: 24793/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5101884323659776 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit aee8477c6ba20469ebe531448d31c642717b5f48) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/rmdec.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
index a36e693ab2..9bb11149e2 100644
--- a/libavformat/rmdec.c
+++ b/libavformat/rmdec.c
@@ -162,7 +162,11 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb,
avio_rb16(pb); /* version2 */
avio_rb32(pb); /* header size */
flavor= avio_rb16(pb); /* add codec info / flavor */
- ast->coded_framesize = coded_framesize = avio_rb32(pb); /* coded frame size */
+ coded_framesize = avio_rb32(pb); /* coded frame size */
+ if (coded_framesize < 0)
+ return AVERROR_INVALIDDATA;
+ ast->coded_framesize = coded_framesize;
+
avio_rb32(pb); /* ??? */
bytes_per_minute = avio_rb32(pb);
if (version == 4) {