Skip to content

Commit

Permalink
don't accept lists/arrays longer than 0x7fffffff
Browse files Browse the repository at this point in the history
  • Loading branch information
KurtThiemann committed Sep 10, 2021
1 parent 6d8123e commit 20b5eee
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Tag/ArrayValueTag.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,14 @@ abstract class ArrayValueTag extends Tag implements Iterator, ArrayAccess, Count

/**
* @inheritDoc
* @throws Exception
*/
public function generatePayload(NbtSerializer $serializer): string
{
$count = $this->count();
if($count > 0x7fffffff) {
throw new \Exception("Array exceeds maximum length of " . 0x7fffffff . " entries");
}
return $serializer->encodeLengthPrefix($this->count()) . $this->generateValues($serializer);
}

Expand Down

0 comments on commit 20b5eee

Please sign in to comment.