summaryrefslogtreecommitdiff
path: root/src/remoteplayer.cpp
diff options
context:
space:
mode:
authorSmallJoker <SmallJoker@users.noreply.github.com>2018-09-14 20:29:21 +0200
committerGitHub <noreply@github.com>2018-09-14 20:29:21 +0200
commit220ec79e4a10ea553310b16eb07d0c7a03fedb78 (patch)
tree778d497359c8c9b7a3880936aea7dabee5d18f70 /src/remoteplayer.cpp
parent81c06dea9b6b863e0c8f6a9c052a5cea3a130eab (diff)
downloadminetest-220ec79e4a10ea553310b16eb07d0c7a03fedb78.tar.gz
minetest-220ec79e4a10ea553310b16eb07d0c7a03fedb78.tar.bz2
minetest-220ec79e4a10ea553310b16eb07d0c7a03fedb78.zip
Inv deSerialize(): Prevent infinite loop, error on failure (#7711)
Throws an error about potentially damaged player inventories but proceeds converting the rest of them
Diffstat (limited to 'src/remoteplayer.cpp')
-rw-r--r--src/remoteplayer.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/remoteplayer.cpp b/src/remoteplayer.cpp
index e7c2462b6..3a72106de 100644
--- a/src/remoteplayer.cpp
+++ b/src/remoteplayer.cpp
@@ -139,7 +139,12 @@ void RemotePlayer::deSerialize(std::istream &is, const std::string &playername,
} catch (SettingNotFoundException &e) {}
}
- inventory.deSerialize(is);
+ try {
+ inventory.deSerialize(is);
+ } catch (SerializationError &e) {
+ errorstream << "Failed to deserialize player inventory. player_name="
+ << name << " " << e.what() << std::endl;
+ }
if (!inventory.getList("craftpreview") && inventory.getList("craftresult")) {
// Convert players without craftpreview