mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-13 01:09:44 +00:00
NetworkBinaryStream: fixed crash when non-compound root tag is provided for itemstack
This commit is contained in:
parent
a4a6d3e094
commit
163ed225f2
@ -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");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user