[FFmpeg-cvslog] avformat/rmdec: Check remaining space in debug av_log() loop

Michael Niedermayer git at videolan.org
Sat Feb 20 22:10:56 EET 2021


ffmpeg | branch: release/4.3 | Michael Niedermayer <michael at niedermayer.cc> | Fri Oct 30 22:04:37 2020 +0100| [b81c4dd4f9c0eb5127b7dcbe862ea148958056de] | committer: Michael Niedermayer

avformat/rmdec: Check remaining space in debug av_log() loop

Fixes: Timeout (long -> 2 ms)
Fixes: 26709/clusterfuzz-testcase-minimized-ffmpeg_dem_IVR_fuzzer-5665833403285504
Fixes: 27522/clusterfuzz-testcase-minimized-ffmpeg_dem_IVR_fuzzer-6321071221112832

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

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

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

diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
index f150dcd111..e8f2657621 100644
--- a/libavformat/rmdec.c
+++ b/libavformat/rmdec.c
@@ -1286,8 +1286,11 @@ static int ivr_read_header(AVFormatContext *s)
                 int j;
 
                 av_log(s, AV_LOG_DEBUG, "%s = '0x", key);
-                for (j = 0; j < len; j++)
+                for (j = 0; j < len; j++) {
+                    if (avio_feof(pb))
+                        return AVERROR_INVALIDDATA;
                     av_log(s, AV_LOG_DEBUG, "%X", avio_r8(pb));
+                }
                 av_log(s, AV_LOG_DEBUG, "'\n");
             } else if (len == 4 && type == 3 && !strncmp(key, "Duration", tlen)) {
                 st->duration = avio_rb32(pb);



More information about the ffmpeg-cvslog mailing list