We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c0cffc1 commit 6d8123eCopy full SHA for 6d8123e
src/Tag/StringTag.php
@@ -39,10 +39,15 @@ public function getLength(): int
39
40
/**
41
* @inheritDoc
42
+ * @throws \Exception
43
*/
44
public function generatePayload(NbtSerializer $serializer): string
45
{
- return $serializer->encodeStringLengthPrefix(strlen($this->value)) . $this->value;
46
+ $length = strlen($this->value);
47
+ if($length > 0xffff) {
48
+ throw new \Exception("String exceeds maximum length of " . 0xffff . " characters");
49
+ }
50
+ return $serializer->encodeStringLengthPrefix($length) . $this->value;
51
}
52
53
0 commit comments