nut: Check chapter creation in decode_info_header
authorAndreas Cadhalpun <andreas.cadhalpun@googlemail.com>
Tue, 28 Apr 2015 18:57:59 +0000 (20:57 +0200)
committerVittorio Giovara <vittorio.giovara@gmail.com>
Tue, 19 May 2015 11:14:39 +0000 (12:14 +0100)
This fixes a segmentation fault when accessing the metadata.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
CC: libav-stable@libav.org
libavformat/nutdec.c

index 36ca754..116c3d4 100644 (file)
@@ -482,6 +482,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];