Skip to content

Commit

Permalink
don't fill an element with bogus size
Browse files Browse the repository at this point in the history
Return early if the size is not valid.
  • Loading branch information
robUx4 committed Jan 13, 2024
1 parent 947926f commit 837c505
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/EbmlElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,15 +219,15 @@ EbmlElement * EbmlElement::FindNextID(IOCallback & DataStream, const EbmlCallbac
if (Result == nullptr)
return nullptr;

Result->SetSizeLength(PossibleSizeLength);

Result->Size = SizeFound;

if (!Result->ValidateSize()) {
delete Result;
return nullptr;
}

Result->SetSizeLength(PossibleSizeLength);

Result->Size = SizeFound;

Result->SetSizeInfinite(SizeFound == SizeUnknown);
Result->ElementPosition = aElementPosition;
Result->SizePosition = aSizePosition;
Expand Down

0 comments on commit 837c505

Please sign in to comment.