demux/ebml: bump ebml size limit to 512 MiB

While the code before 571f9b0f23 had a
typo and it was intended to be 100 MB, there are files that exceed this
limit, like 147 MiB. Increase the limit to 512 MiB which should be more
than enough for valid files.

From quick look ffmpeg limits to 1<<8 bytes, so we should be good with
our new limit.

In theory this limit could be removed, but it is better to play the
file, possibly with skipped some corrupted block of data, instead OOM.

Fixes: 571f9b0f23
This commit is contained in:
Kacper Michajłow 2024-07-15 15:59:04 +02:00
parent 202ecc17af
commit 4764e41cac
1 changed files with 2 additions and 2 deletions

View File

@ -604,8 +604,8 @@ int ebml_read_element(struct stream *s, struct ebml_parse_ctx *ctx,
MP_MSG(ctx, msglevel, "EBML element with unknown length - unsupported\n"); MP_MSG(ctx, msglevel, "EBML element with unknown length - unsupported\n");
return -1; return -1;
} }
if (length > (128 << 20)) { if (length > (512 << 20)) {
MP_MSG(ctx, msglevel, "Refusing to read element over 128 MiB in size\n"); MP_MSG(ctx, msglevel, "Element too big (%" PRIu64 " MiB) - skipping\n", length >> 20);
return -1; return -1;
} }
ctx->talloc_ctx = talloc_size(NULL, length); ctx->talloc_ctx = talloc_size(NULL, length);