diff mbox series

[FFmpeg-devel,2/5] avformat/cafdec: Check for EOF in index reading loop

Message ID 20201022224112.9071-2-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,1/5] avformat/mpegts: Limit iterations of get_packet_size()
Related show

Checks

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

Commit Message

Michael Niedermayer Oct. 22, 2020, 10:41 p.m. UTC
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/cafdec.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c
index d0f942f3e4..cd6b550aad 100644
--- a/libavformat/cafdec.c
+++ b/libavformat/cafdec.c
@@ -202,6 +202,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);