From 496d53a2f2f7db361e558aa69051fcce7ef63b7f Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 3 Sep 2015 13:39:00 +0200 Subject: ebml: warn if an EBML has unknown length While unknown lengths are supported in some important cases like segments and clusters, they are not for small and complex metadata elements like the track list. Such elements are simply rejected. This case was caught by the size sanity check below, but the message is misleading and wrong. (There are likely no files in the wild which require support for this. The sample file I've seen was muxed by libavformat, but in a case where it aborted when writing the header. Clearly a broken file.) --- demux/ebml.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/demux/ebml.c b/demux/ebml.c index 5f1ed37415..dbdc5e26ea 100644 --- a/demux/ebml.c +++ b/demux/ebml.c @@ -631,6 +631,10 @@ int ebml_read_element(struct stream *s, struct ebml_parse_ctx *ctx, "- partial or corrupt file?\n"); return -1; } + if (length == EBML_UINT_INVALID) { + MP_MSG(ctx, msglevel, "EBML element with unknown length - unsupported\n"); + return -1; + } if (length > 1000000000) { MP_MSG(ctx, msglevel, "Refusing to read element over 100 MB in size\n"); return -1; -- cgit v1.2.3