Skip to content

Commit

Permalink
demux_mkv: limit EBML size to 64 MiB for fuzzing
Browse files Browse the repository at this point in the history
OSS-Fuzz is limited to 2GiB of process memory, so allocating 512 MiB is
not working well and causing OOMs.
  • Loading branch information
kasper93 committed Dec 12, 2024
1 parent c14af4e commit 5897b66
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions demux/ebml.c
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,11 @@ 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;
}
#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
if (length > (512 << 20)) {
#else
if (length > (64 << 20)) {
#endif
MP_MSG(ctx, msglevel, "Element too big (%" PRIu64 " MiB) - skipping\n", length >> 20);
return -1;
}
Expand Down

0 comments on commit 5897b66

Please sign in to comment.