mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
fixed crash exploit
This commit is contained in:
parent
b229dff4ba
commit
6f5d62f302
1 changed files with 16 additions and 0 deletions
|
|
@ -2423,8 +2423,24 @@ class Player{
|
|||
break;
|
||||
}
|
||||
if($this->isSleeping) break;
|
||||
|
||||
|
||||
//prevent crash caused by nan values
|
||||
if(is_nan($packet->x) || is_nan($packet->y) || is_nan($packet->z)){
|
||||
ConsoleAPI::warn("{$this->username} Attempted to crash the server using NaN position!");
|
||||
$this->close("invalid position");
|
||||
break;
|
||||
}
|
||||
|
||||
if(($this->entity instanceof Entity) && $packet->messageIndex > $this->lastMovement){
|
||||
$this->lastMovement = $packet->messageIndex;
|
||||
//prevent all movement this far - vanilla collisions break there
|
||||
//farther distances(like inf) may cause client and server crash
|
||||
if(abs($packet->x) >= 8388608 || abs($packet->y) >= 8388608 || abs($packet->z) >= 8388608){
|
||||
$this->addEntityMovementUpdateToQueue($this->entity);
|
||||
break;
|
||||
}
|
||||
|
||||
$newPos = new Vector3($packet->x, $packet->y, $packet->z);
|
||||
if($this->forceMovement instanceof Vector3){
|
||||
if($this->forceMovement->distance($newPos) <= 0.7){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue