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 25, 2024
1 parent 89dab92 commit 95e7d8d
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 @@ -324,6 +324,7 @@ EbmlElement * EbmlElement::FindNextElement(IOCallback & DataStream, const EbmlSe
///< \todo continue is misplaced
if (Result != nullptr) {
if (AllowDummyElt || !Result->IsDummy()) {
assert(Result->ElementSpec().IsSizeValid(SizeFound));
Result->SetSizeLength(_SizeLength);

Result->Size = SizeFound;
Expand All @@ -332,7 +333,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 95e7d8d

Please sign in to comment.