mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-09 03:06:55 +00:00
NetworkBinaryStream: fixed crash when non-compound root tag is provided for itemstack
This commit is contained in:
@ -93,7 +93,11 @@ class NetworkBinaryStream extends BinaryStream{
|
|||||||
if($c !== 1){
|
if($c !== 1){
|
||||||
throw new \UnexpectedValueException("Unexpected NBT count $c");
|
throw new \UnexpectedValueException("Unexpected NBT count $c");
|
||||||
}
|
}
|
||||||
$nbt = (new NetworkLittleEndianNBTStream())->read($this->buffer, false, $this->offset, 512);
|
$decodedNBT = (new NetworkLittleEndianNBTStream())->read($this->buffer, false, $this->offset, 512);
|
||||||
|
if(!($decodedNBT instanceof CompoundTag)){
|
||||||
|
throw new \UnexpectedValueException("Unexpected root tag type for itemstack");
|
||||||
|
}
|
||||||
|
$nbt = $decodedNBT;
|
||||||
}elseif($nbtLen !== 0){
|
}elseif($nbtLen !== 0){
|
||||||
throw new \UnexpectedValueException("Unexpected fake NBT length $nbtLen");
|
throw new \UnexpectedValueException("Unexpected fake NBT length $nbtLen");
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user