aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-01-20 00:11:34 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2021-09-09 13:53:29 +0200
commitc7476379197ec5acd288ad616418037bccecaf17 (patch)
treef8f399c66c5111f5346411fb30d5a851212e2f20
parent90205d2107316e9d68b19f4d450cdbd2546fffaf (diff)
downloadffmpeg-c7476379197ec5acd288ad616418037bccecaf17.tar.gz
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@niedermayer.cc> (cherry picked from commit bcb1e9d3b9b97359e01e5978067c8ee558efa8b4) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/paf.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavformat/paf.c b/libavformat/paf.c
index a2d411c2f6..47b61c226a 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 ||