[FFmpeg-cvslog] avformat/cafdec: Check for EOF in index read loop

Michael Niedermayer git at videolan.org
Sun Nov 29 17:16:25 EET 2020


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Wed Nov 18 00:58:37 2020 +0100| [eb46939e3ab3e0e4df69486b1a037bffc50493bd] | committer: Michael Niedermayer

avformat/cafdec: Check for EOF in index read loop

Fixes: OOM
Fixes: 27398/clusterfuzz-testcase-minimized-ffmpeg_dem_CAF_fuzzer-541296033975500

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=eb46939e3ab3e0e4df69486b1a037bffc50493bd
---

 libavformat/cafdec.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c
index 06069f2610..c1a9838b06 100644
--- a/libavformat/cafdec.c
+++ b/libavformat/cafdec.c
@@ -205,6 +205,8 @@ static int read_pakt_chunk(AVFormatContext *s, int64_t size)
 
     st->duration = 0;
     for (i = 0; i < num_packets; i++) {
+        if (avio_feof(pb))
+            return AVERROR_INVALIDDATA;
         av_add_index_entry(s->streams[0], pos, st->duration, 0, 0, AVINDEX_KEYFRAME);
         pos += caf->bytes_per_packet ? caf->bytes_per_packet : ff_mp4_read_descr_len(pb);
         st->duration += caf->frames_per_packet ? caf->frames_per_packet : ff_mp4_read_descr_len(pb);



More information about the ffmpeg-cvslog mailing list