1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00

matroskadec: fix crash when parsing invalid mkv

CC: libav-stable@libav.org

Signed-off-by: Anton Khirnov <anton@khirnov.net>
This commit is contained in:
Thomas Guillem 2015-04-10 19:04:51 +02:00 committed by Anton Khirnov
parent 1336bb06c9
commit b8d7f3186e

View File

@ -1827,8 +1827,12 @@ static int matroska_read_header(AVFormatContext *s)
matroska->ctx = s;
/* 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) {