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.)
This commit is contained in:
wm4 2015-09-03 13:39:00 +02:00
parent 90efe329b9
commit 496d53a2f2
1 changed files with 4 additions and 0 deletions

View File

@ -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;