aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-08-16 18:05:34 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-09-09 13:37:21 +0200
commit75ce842d7c3de47ffbe86b3c1f6c1cbc912daf14 (patch)
treedf04c1065e4a48ae269a691eea6fb47e2d613cb7
parent13de14d44da9d224152620b39040dbf01cb94f86 (diff)
downloadffmpeg-75ce842d7c3de47ffbe86b3c1f6c1cbc912daf14.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 5af5beccb3..1b4a298bc6 100644
--- a/libavformat/rmdec.c
+++ b/libavformat/rmdec.c
@@ -164,7 +164,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) {