From e3cffca34b946e09fe568418046e7e18d39da0c0 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 5 Dec 2019 11:05:34 +0000 Subject: [PATCH] StartGamePacket: fixed possible type violation on decoding block table --- src/pocketmine/network/mcpe/protocol/StartGamePacket.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pocketmine/network/mcpe/protocol/StartGamePacket.php b/src/pocketmine/network/mcpe/protocol/StartGamePacket.php index 64084152c..fb32c4f0c 100644 --- a/src/pocketmine/network/mcpe/protocol/StartGamePacket.php +++ b/src/pocketmine/network/mcpe/protocol/StartGamePacket.php @@ -211,7 +211,11 @@ class StartGamePacket extends DataPacket{ $this->enchantmentSeed = $this->getVarInt(); - $this->blockTable = (new NetworkLittleEndianNBTStream())->read($this->buffer, false, $this->offset, 512); + $blockTable = (new NetworkLittleEndianNBTStream())->read($this->buffer, false, $this->offset, 512); + if(!($blockTable instanceof ListTag)){ + throw new \UnexpectedValueException("Wrong block table root NBT tag type"); + } + $this->blockTable = $blockTable; $this->itemTable = []; for($i = 0, $count = $this->getUnsignedVarInt(); $i < $count; ++$i){