RegionLoader: account for possible corrupted header pointing to itself

This commit is contained in:
Dylan K. Taylor 2020-06-15 12:13:42 +01:00
parent b92a2ded8a
commit b559a65346

View File

@ -277,8 +277,11 @@ class RegionLoader{
if($offset === 0 or $sectorCount === 0){
$this->locationTable[$i] = null;
}elseif($offset >= self::FIRST_SECTOR){
$this->bumpNextFreeSector($this->locationTable[$i] = new RegionLocationTableEntry($offset, $sectorCount, $timestamp));
}else{
$this->bumpNextFreeSector($this->locationTable[$i] = new RegionLocationTableEntry($offset, $index & 0xff, $timestamp));
self::getChunkCoords($i, $chunkXX, $chunkZZ);
throw new CorruptedRegionException("Invalid region header entry for x=$chunkXX z=$chunkZZ, offset overlaps with header");
}
}