Skip to content

Commit

Permalink
demux/ebml: bump ebml size limit to 512 MiB
Browse files Browse the repository at this point in the history
While the code before 571f9b0 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: 571f9b0
  • Loading branch information
kasper93 committed Jul 15, 2024
1 parent c0f5d23 commit 9b63b83
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions demux/ebml.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
return -1;
}
if (length > (128 << 20)) {
MP_MSG(ctx, msglevel, "Refusing to read element over 128 MiB in size\n");
if (length > (512 << 20)) {
MP_MSG(ctx, msglevel, "Element too big (%" PRIu64 " MiB) - skipping\n", length >> 20);
return -1;
}
ctx->talloc_ctx = talloc_size(NULL, length);
Expand Down

0 comments on commit 9b63b83

Please sign in to comment.