nutdec: check chapter creation in decode_info_header
authorAndreas Cadhalpun <andreas.cadhalpun@googlemail.com>
Tue, 28 Apr 2015 18:57:59 +0000 (20:57 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 19 May 2015 19:21:39 +0000 (21:21 +0200)
This fixes a segmentation fault when accessing the metadata.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3ff1af2b0db7132d5717be6395227a94c8abab07)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/nutdec.c

index 11e7e43..7ae722b 100644 (file)
@@ -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];