path: root/demux
diff options
authorwm4 <wm4@nowhere>2015-09-03 13:39:00 +0200
committerwm4 <wm4@nowhere>2015-09-03 13:39:00 +0200
commit496d53a2f2f7db361e558aa69051fcce7ef63b7f (patch)
tree916f15370ff574476b0470391f363e1fadbdbe41 /demux
parent90efe329b9763ef89d2be71b58bfbf77f4c5f8d6 (diff)
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.)
Diffstat (limited to 'demux')
1 files changed, 4 insertions, 0 deletions
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;