diff mbox series

[FFmpeg-devel,4/5] avformat/cafdec: Check the return code from av_add_index_entry()

Message ID 20201022224112.9071-4-michael@niedermayer.cc
State Accepted
Commit 9dc3301745d8271ae3ba0f1b998d8e6a0aa01bc1
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 | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c
index 1e9c8c2b0b..5da37ab8dd 100644
--- a/libavformat/cafdec.c
+++ b/libavformat/cafdec.c
@@ -192,6 +192,7 @@  static int read_pakt_chunk(AVFormatContext *s, int64_t size)
     CafContext *caf   = s->priv_data;
     int64_t pos = 0, ccount, num_packets;
     int i;
+    int ret;
 
     ccount = avio_tell(pb);
 
@@ -207,7 +208,9 @@  static int read_pakt_chunk(AVFormatContext *s, int64_t size)
     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);
+        ret = av_add_index_entry(s->streams[0], pos, st->duration, 0, 0, AVINDEX_KEYFRAME);
+        if (ret < 0)
+            return ret;
         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);
     }