[FFmpeg-cvslog] avformat/paf: Check for EOF before allocation in read_header()

Michael Niedermayer git at videolan.org
Mon Mar 8 23:12:39 EET 2021


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Wed Jan 20 00:11:34 2021 +0100| [bcb1e9d3b9b97359e01e5978067c8ee558efa8b4] | committer: Michael Niedermayer

avformat/paf: Check for EOF before allocation in read_header()

Fixes: OOM
Fixes: 26584/clusterfuzz-testcase-minimized-ffmpeg_dem_PAF_fuzzer-5172661183053824

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavformat/paf.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavformat/paf.c b/libavformat/paf.c
index 6183dc1115..dbc50100fb 100644
--- a/libavformat/paf.c
+++ b/libavformat/paf.c
@@ -136,6 +136,10 @@ static int read_header(AVFormatContext *s)
     p->start_offset   = avio_rl32(pb);
     p->max_video_blks = avio_rl32(pb);
     p->max_audio_blks = avio_rl32(pb);
+
+    if (avio_feof(pb))
+        return AVERROR_INVALIDDATA;
+
     if (p->buffer_size    < 175  ||
         p->max_audio_blks < 2    ||
         p->max_video_blks < 1    ||



More information about the ffmpeg-cvslog mailing list