diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-04-18 21:12:05 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-04-18 21:13:25 +0200 |
commit | f98cad87590e337375f654407bcc64683a7c1294 (patch) | |
tree | 8bd578199e7f1f3d1724b91fc45481aec1d33c6a | |
parent | 4c2b88678b436f59132386d9be2fc143e3ee480d (diff) | |
parent | b8d7f3186e86234f6255f5e8ee9e98573b4d9a6e (diff) | |
download | ffmpeg-f98cad87590e337375f654407bcc64683a7c1294.tar.gz |
Merge commit 'b8d7f3186e86234f6255f5e8ee9e98573b4d9a6e'
* commit 'b8d7f3186e86234f6255f5e8ee9e98573b4d9a6e':
matroskadec: fix crash when parsing invalid mkv
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/matroskadec.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 396c1de9b8..f53352e990 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -2080,8 +2080,12 @@ static int matroska_read_header(AVFormatContext *s) matroska->cues_parsing_deferred = 1; /* First read the EBML header. */ - if (ebml_parse(matroska, ebml_syntax, &ebml) || - ebml.version > EBML_VERSION || + if (ebml_parse(matroska, ebml_syntax, &ebml) || !ebml.doctype) { + av_log(matroska->ctx, AV_LOG_ERROR, "EBML header parsing failed\n"); + ebml_free(ebml_syntax, &ebml); + return AVERROR_INVALIDDATA; + } + if (ebml.version > EBML_VERSION || ebml.max_size > sizeof(uint64_t) || ebml.id_length > sizeof(uint32_t) || ebml.doctype_version > 3 || |