diff --git a/src/EbmlMaster.cpp b/src/EbmlMaster.cpp index 071eb5dc..465560f6 100644 --- a/src/EbmlMaster.cpp +++ b/src/EbmlMaster.cpp @@ -455,9 +455,12 @@ void EbmlMaster::Read(EbmlStream & inDataStream, const EbmlSemanticContext & sCo if (UpperEltFound > 0) { UpperEltFound--; - if (UpperEltFound > 0 || MaxSizeToRead <= 0) + if (UpperEltFound > 0) goto processCrc; ElementLevelA = FoundElt; + if (IsFiniteSize() && ElementLevelA->IsFiniteSize()) { + MaxSizeToRead = GetEndPosition() - ElementLevelA->GetEndPosition(); // even if it's the default value + } continue; }