Skip to content

Commit

Permalink
replace test on valid size with an assert
Browse files Browse the repository at this point in the history
CreateElementUsingContext() never creates an element with an invalid size.
  • Loading branch information
robUx4 committed Feb 26, 2024
1 parent 8aa4cd3 commit 4654614
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/EbmlElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ EbmlElement * EbmlElement::FindNextElement(IOCallback & DataStream, const EbmlSe
///< \todo continue is misplaced
if (Result != nullptr) {
if (AllowDummyElt || !Result->IsDummy()) {
assert(Result->ElementSpec().IsSizeValid(SizeFound, SizeFound == SizeUnknown));
Result->SetSizeLength(_SizeLength);

Result->Size = SizeFound;
Expand All @@ -329,7 +330,7 @@ EbmlElement * EbmlElement::FindNextElement(IOCallback & DataStream, const EbmlSe
// 0 : child
// 1 : same level
// + : further parent
if (Result->ElementSpec().IsSizeValid(SizeFound) && (SizeFound == SizeUnknown || UpperLevel > 0 || MaxDataSize == 0 ||
if ((SizeFound == SizeUnknown || UpperLevel > 0 || MaxDataSize == 0 ||
MaxDataSize >= (IdStart + PossibleID_Length + _SizeLength + SizeFound))) {
Result->ElementPosition = ParseStart + IdStart;
Result->SizePosition = Result->ElementPosition + PossibleID_Length;
Expand Down

0 comments on commit 4654614

Please sign in to comment.