avformat/format: Check for av_guess_format() failure

Fixes null pointer dereference
Fixes Ticket3812

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2014-08-02 04:16:02 +02:00
parent 26ffa8eaee
commit 98e42a249e
1 changed files with 3 additions and 1 deletions

View File

@ -145,7 +145,9 @@ enum AVCodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name,
enum AVMediaType type) enum AVMediaType type)
{ {
if (av_match_name("segment", fmt->name) || av_match_name("ssegment", fmt->name)) { 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) { if (type == AVMEDIA_TYPE_VIDEO) {