avformat/format: Check for av_guess_format() failure
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 2 Aug 2014 02:16:02 +0000 (04:16 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 2 Aug 2014 02:16:02 +0000 (04:16 +0200)
Fixes null pointer dereference
Fixes Ticket3812

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

index 238a13a..1c25d6b 100644 (file)
@@ -145,7 +145,9 @@ enum AVCodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name,
                               enum AVMediaType type)
 {
     if (av_match_name("segment", fmt->name) || av_match_name("ssegment", fmt->name)) {
-        fmt = av_guess_format(NULL, filename, NULL);
+        AVOutputFormat *fmt2 = av_guess_format(NULL, filename, NULL);
+        if (fmt2)
+            fmt = fmt2;
     }
 
     if (type == AVMEDIA_TYPE_VIDEO) {