Matroska: Raise the global EBML element bound above real-file needs

[5f869755] gave the whole-file element budget the same value as the per-container
limit (50000). A real 6,027,872,050-byte .mka requires 99780 elements, so
MasterElement::read() returns false and the file is unopenable at every ReadStyle.

Raise the global bound to 1000000, leaving the per-level bound untouched. That is
~10x a large real file's requirement and still an order of magnitude below the
'millions of small elements' case the original commit guards against.
This commit is contained in:
GarryH
2026-09-27 08:21:09 +02:00
committed by GitHub
parent 0faf7291ca
commit 8503099543
+4 -1
View File
@@ -107,7 +107,10 @@ bool EBML::MasterElement::read(File &file, int depth)
bool EBML::MasterElement::read(File &file, int depth, unsigned int &elementCount)
{
static constexpr int MAX_EBML_DEPTH = 64;
static constexpr int MAX_EBML_ELEMENT_COUNT = 50000;
// Whole-file budget. Must be considerably larger than the per-level limit below: a Matroska's
// Cues/SeekHead index scales with duration, and a real 6.0 GB, 48-minute album measures at 99780
// elements, so a 50000 whole-file budget rejects ordinary media outright.
static constexpr int MAX_EBML_ELEMENT_COUNT = 1000000;
static constexpr int MAX_EBML_ELEMENT_COUNT_PER_LEVEL = 50000;
if(depth > MAX_EBML_DEPTH) {
debug("EBML: Maximum nesting depth exceeded");