diff mbox series

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

Message ID 20210119233223.21888-3-michael@niedermayer.cc
State Accepted
Commit bcb1e9d3b9b97359e01e5978067c8ee558efa8b4
Headers show
Series [FFmpeg-devel,1/3] avformat/asfdec_o: Check for EOF in asf_read_marker() | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Michael Niedermayer Jan. 19, 2021, 11:32 p.m. UTC
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 | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Michael Niedermayer March 8, 2021, 8:51 p.m. UTC | #1
On Wed, Jan 20, 2021 at 12:32:23AM +0100, Michael Niedermayer wrote:
> 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 | 4 ++++
>  1 file changed, 4 insertions(+)

will apply

[...]
diff mbox series

Patch

diff --git a/libavformat/paf.c b/libavformat/paf.c
index bcd6213a45..23ad4bf41f 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    ||