summaryrefslogtreecommitdiffstats
path: root/src/WorldStorage/WSSCompact.cpp
diff options
context:
space:
mode:
authorjfhumann <j.f.humann@gmail.com>2014-04-26 00:43:01 +0200
committerjfhumann <j.f.humann@gmail.com>2014-04-26 00:43:01 +0200
commitc8d5fcfffa7540898a92546094c2d3040740eb5a (patch)
treead03b702fe85313bb7b449e5623439f4fa564a04 /src/WorldStorage/WSSCompact.cpp
parentShould fix CIDs 43631, 43632 and 43633 (diff)
downloadcuberite-c8d5fcfffa7540898a92546094c2d3040740eb5a.tar
cuberite-c8d5fcfffa7540898a92546094c2d3040740eb5a.tar.gz
cuberite-c8d5fcfffa7540898a92546094c2d3040740eb5a.tar.bz2
cuberite-c8d5fcfffa7540898a92546094c2d3040740eb5a.tar.lz
cuberite-c8d5fcfffa7540898a92546094c2d3040740eb5a.tar.xz
cuberite-c8d5fcfffa7540898a92546094c2d3040740eb5a.tar.zst
cuberite-c8d5fcfffa7540898a92546094c2d3040740eb5a.zip
Diffstat (limited to 'src/WorldStorage/WSSCompact.cpp')
-rw-r--r--src/WorldStorage/WSSCompact.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/WorldStorage/WSSCompact.cpp b/src/WorldStorage/WSSCompact.cpp
index 5435e6d5a..59b8e4f6c 100644
--- a/src/WorldStorage/WSSCompact.cpp
+++ b/src/WorldStorage/WSSCompact.cpp
@@ -468,7 +468,15 @@ cWSSCompact::cPAKFile::cPAKFile(const AString & a_FileName, int a_LayerX, int a_
for (int i = 0; i < NumChunks; i++)
{
sChunkHeader * Header = new sChunkHeader;
- READ(*Header);
+
+ // Here we do not use the READ macro, as it does not free the resources
+ // allocated with new in case of error.
+ if (f.Read(Header, sizeof(*Header)) != sizeof(*Header))
+ {
+ LOGERROR("ERROR READING %s FROM FILE %s (line %d); file offset %d", "Header", m_FileName.c_str(), __LINE__, f.Tell());
+ delete Header;
+ return;
+ }
m_ChunkHeaders.push_back(Header);
} // for i - chunk headers