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)
committerLuca Barbato <lu_zero@gentoo.org>
Fri, 8 May 2015 09:10:51 +0000 (11:10 +0200)
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 71eaba4..ed28107 100644 (file)
@@ -487,6 +487,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];