]> git.sesse.net Git - ffmpeg/commitdiff
avformat/paf: Check for EOF before allocation in read_header()
authorMichael Niedermayer <michael@niedermayer.cc>
Tue, 19 Jan 2021 23:11:34 +0000 (00:11 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Mon, 8 Mar 2021 21:08:49 +0000 (22:08 +0100)
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@niedermayer.cc>
libavformat/paf.c

index 6183dc111533365dab9706fdce2386d0bab30a9c..dbc50100fb534542166b2d0140dbf7b0fed42702 100644 (file)
@@ -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    ||