From ec949840b275a249d68cbb3ee5247997e75aa0fe Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 1 Apr 2020 21:30:25 +0100 Subject: [PATCH 1/5] Do not crash on failure to decompress region chunks this could happen when a chunk was partially overwritten with one of the same sector size. --- src/pocketmine/level/format/io/region/Anvil.php | 7 ++++++- src/pocketmine/level/format/io/region/McRegion.php | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/pocketmine/level/format/io/region/Anvil.php b/src/pocketmine/level/format/io/region/Anvil.php index d602fd8a2..6464269cf 100644 --- a/src/pocketmine/level/format/io/region/Anvil.php +++ b/src/pocketmine/level/format/io/region/Anvil.php @@ -33,6 +33,7 @@ use pocketmine\nbt\tag\ByteArrayTag; use pocketmine\nbt\tag\CompoundTag; use pocketmine\nbt\tag\IntArrayTag; use pocketmine\nbt\tag\ListTag; +use function zlib_decode; class Anvil extends McRegion{ @@ -96,8 +97,12 @@ class Anvil extends McRegion{ } protected function nbtDeserialize(string $data) : Chunk{ + $data = @zlib_decode($data); + if($data === false){ + throw new CorruptedChunkException("Failed to decompress chunk data"); + } $nbt = new BigEndianNBTStream(); - $chunk = $nbt->readCompressed($data); + $chunk = $nbt->read($data); if(!($chunk instanceof CompoundTag) or !$chunk->hasTag("Level")){ throw new CorruptedChunkException("'Level' key is missing from chunk NBT"); } diff --git a/src/pocketmine/level/format/io/region/McRegion.php b/src/pocketmine/level/format/io/region/McRegion.php index 3516fc598..946ee5170 100644 --- a/src/pocketmine/level/format/io/region/McRegion.php +++ b/src/pocketmine/level/format/io/region/McRegion.php @@ -58,6 +58,7 @@ use function strrpos; use function substr; use function time; use function unpack; +use function zlib_decode; use const SCANDIR_SORT_NONE; class McRegion extends BaseLevelProvider{ @@ -125,8 +126,12 @@ class McRegion extends BaseLevelProvider{ * @throws CorruptedChunkException */ protected function nbtDeserialize(string $data) : Chunk{ + $data = @zlib_decode($data); + if($data === false){ + throw new CorruptedChunkException("Failed to decompress chunk data"); + } $nbt = new BigEndianNBTStream(); - $chunk = $nbt->readCompressed($data); + $chunk = $nbt->read($data); if(!($chunk instanceof CompoundTag) or !$chunk->hasTag("Level")){ throw new CorruptedChunkException("'Level' key is missing from chunk NBT"); } From 5f33ef35e33441754795619ebf10ceec425affa6 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 9 Apr 2020 21:13:54 +0100 Subject: [PATCH 2/5] build: allow providing a git hash --- build/server-phar.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/build/server-phar.php b/build/server-phar.php index d99bf9943..95d725e4c 100644 --- a/build/server-phar.php +++ b/build/server-phar.php @@ -130,9 +130,13 @@ function main() : void{ exit(1); } - $opts = getopt("", ["out:"]); - $gitHash = Git::getRepositoryStatePretty(dirname(__DIR__)); - echo "Git hash detected as $gitHash" . PHP_EOL; + $opts = getopt("", ["out:", "git:"]); + if(isset($opts["git"])){ + $gitHash = $opts["git"]; + }else{ + $gitHash = Git::getRepositoryStatePretty(dirname(__DIR__)); + echo "Git hash detected as $gitHash" . PHP_EOL; + } foreach(buildPhar( $opts["out"] ?? getcwd() . DIRECTORY_SEPARATOR . "PocketMine-MP.phar", dirname(__DIR__) . DIRECTORY_SEPARATOR, From 5f07c5df1cb9c0c92f0f61f979248978ed8c87af Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sun, 12 Apr 2020 03:40:14 +0000 Subject: [PATCH 3/5] Bump irstea/phpunit-shim from 8.5.2 to 8.5.3 (#3384) --- composer.lock | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/composer.lock b/composer.lock index 070ba223e..5bb800d84 100644 --- a/composer.lock +++ b/composer.lock @@ -424,11 +424,11 @@ "packages-dev": [ { "name": "irstea/phpunit-shim", - "version": "8.5.2", + "version": "8.5.3", "source": { "type": "git", "url": "https://gitlab.irstea.fr/pole-is/tools/phpunit-shim.git", - "reference": "8ec63f895972681271191821a36f9081c236b993" + "reference": "b55d058d7ad3cf516068f22138a5b8fb724605db" }, "require": { "ext-dom": "*", @@ -474,7 +474,7 @@ "testing", "xunit" ], - "time": "2020-01-23T13:39:47+00:00" + "time": "2020-04-01T02:21:12+00:00" }, { "name": "phpstan/phpstan", @@ -513,20 +513,6 @@ "MIT" ], "description": "PHPStan - PHP Static Analysis Tool", - "funding": [ - { - "url": "https://github.com/ondrejmirtes", - "type": "github" - }, - { - "url": "https://www.patreon.com/phpstan", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", - "type": "tidelift" - } - ], "time": "2020-03-22T16:51:47+00:00" }, { @@ -663,6 +649,5 @@ "ext-zip": "*", "ext-zlib": ">=1.2.11" }, - "platform-dev": [], - "plugin-api-version": "1.1.0" + "platform-dev": [] } From 5c12a95151d0c36aa506f4711caf4dc1f1a5c38f Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 14 Apr 2020 01:43:02 +0100 Subject: [PATCH 4/5] phpstan: force static reflection for COM class com_dotnet has crap reflection exports and the class name case doesn't match. --- phpstan.neon.dist | 2 ++ 1 file changed, 2 insertions(+) diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 8bfdcfc29..5598dc316 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -31,6 +31,8 @@ parameters: - tests/phpstan/stubs/pthreads.stub - tests/phpstan/stubs/chunkutils.stub reportUnmatchedIgnoredErrors: false #no other way to silence platform-specific non-warnings + staticReflectionClassNamePatterns: + - "#^COM$#" ignoreErrors: - message: "#^Instanceof between pocketmine\\\\plugin\\\\PluginManager and pocketmine\\\\plugin\\\\PluginManager will always evaluate to true\\.$#" From 3aa58f54dc352b0704b5ccb7c07373b1026e4202 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 14 Apr 2020 02:54:40 +0100 Subject: [PATCH 5/5] Release 3.11.7 --- changelogs/3.11.md | 16 ++++++++++++++++ src/pocketmine/VersionInfo.php | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/changelogs/3.11.md b/changelogs/3.11.md index 3e471a43c..0ed526394 100644 --- a/changelogs/3.11.md +++ b/changelogs/3.11.md @@ -79,3 +79,19 @@ Plugin developers should **only** update their required API to this version if y - `ThreadManager` is now lazily initialized. - Removed raw NBT storage from `Item` internals. The following methods are now deprecated: - `Item::setCompoundTag()` + +# 3.11.7 +- Build system: Fixed crash reports of Jenkins builds being rejected by the crash archive as invalid. +- Introduced a new dependency on `pocketmine/log-pthreads`, which contains classes separated from `pocketmine/log`. +- Fixed minimum composer stability preventing any newer version of `pocketmine/pocketmine-mp` being installed than 3.3.4 by replacing `daverandom/callback-validator` with [`pocketmine/callback-validator`](https://github.com/pmmp/CallbackValidator). +- Fixed every player seeing eating particles when any player eats. +- Fixed setting held item not working during `BlockBreakEvent`, `PlayerInteractEvent` and `EntityDamageEvent`. +- Fixed some incorrect documented types in `PlayerQuitEvent` reported by PHPStan. +- Fixed documentation of `Item->pop()` return value. +- Fixed server crash on encountering corrupted compressed data stored in region files. +- Protocol: Split screen header is now properly accounted for during decoding. Note that split screen is still not supported natively, but their packets can be decoded properly now. +- Protocol: Fixed wrong order of fields in `UpdateTradePacket`. +- Protocol: Fixed loss of `fullSkinId` when decoding network skins. +- Fixed RCON not being able to bind to port after a fast server restart. + + diff --git a/src/pocketmine/VersionInfo.php b/src/pocketmine/VersionInfo.php index db462770c..50ed5a558 100644 --- a/src/pocketmine/VersionInfo.php +++ b/src/pocketmine/VersionInfo.php @@ -34,5 +34,5 @@ const _VERSION_INFO_INCLUDED = true; const NAME = "PocketMine-MP"; const BASE_VERSION = "3.11.7"; -const IS_DEVELOPMENT_BUILD = true; +const IS_DEVELOPMENT_BUILD = false; const BUILD_NUMBER = 0;