[FFmpeg-devel] [PATCH 2/3] nutdec: check chapter creation in decode_info_header

Andreas Cadhalpun andreas.cadhalpun at googlemail.com
Tue Apr 28 20:57:59 CEST 2015


This fixes a segmentation fault when accessing the metadata.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
---
 libavformat/nutdec.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index 46946d3..2049f70 100644
--- a/libavformat/nutdec.c
+++ b/libavformat/nutdec.c
@@ -505,6 +505,10 @@ static int decode_info_header(NUTContext *nut)
                                      nut->time_base[chapter_start %
                                                     nut->time_base_count],
                                      start, start + chapter_len, NULL);
+        if (!chapter) {
+            av_log(s, AV_LOG_ERROR, "could not create chapter\n");
+            return AVERROR_ENOMEM;
+        }
         metadata = &chapter->metadata;
     } else if (stream_id_plus1) {
         st       = s->streams[stream_id_plus1 - 1];
-- 
2.1.4


More information about the ffmpeg-devel mailing list