avformat/concatdec: Check file variable before dereferencing
authorMichael Niedermayer <michael@niedermayer.cc>
Thu, 3 Sep 2015 11:35:37 +0000 (13:35 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 3 Sep 2015 16:53:44 +0000 (18:53 +0200)
Fixes CID1322328

Reviewed-by: Ganesh Ajjanagadde <gajjanag@mit.edu>
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/concatdec.c

index 969b001..88b6dbe 100644 (file)
@@ -394,6 +394,11 @@ static int concat_read_header(AVFormatContext *avf)
                 av_log(avf, AV_LOG_ERROR, "Line %d: packet metadata required\n", line);
                 FAIL(AVERROR_INVALIDDATA);
             }
+            if (!file) {
+                av_log(avf, AV_LOG_ERROR, "Line %d: %s without file\n",
+                       line, keyword);
+                FAIL(AVERROR_INVALIDDATA);
+            }
             if ((ret = av_dict_parse_string(&file->metadata, metadata, "=", "", 0)) < 0) {
                 av_log(avf, AV_LOG_ERROR, "Line %d: failed to parse metadata string\n", line);
                 av_freep(&metadata);