X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Fmatroskadec.c;h=98efc7c03439ab8035b85c3e1caa90e712a15647;hb=3ff1af2b0db7132d5717be6395227a94c8abab07;hp=396c1de9b891d04f5d74aa86cb5b117ad310d6f8;hpb=ee69229dd806709a51b70184640c2f298cd99d2b;p=ffmpeg diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 396c1de9b89..98efc7c0343 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -2080,12 +2080,15 @@ 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 || - !ebml.doctype) { + ebml.doctype_version > 3) { av_log(matroska->ctx, AV_LOG_ERROR, "EBML header using unsupported features\n" "(EBML version %"PRIu64", doctype %s, doc version %"PRIu64")\n",