summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-05-09 21:20:27 +0200
committerMattes D <github@xoft.cz>2014-05-09 21:20:27 +0200
commita38d8b6513215a542cc0d450f95c90291b699d8e (patch)
tree132dcfa19bf05d92f0e04c622f4ae54f03f7e029 /src
parentFixed size_t in FireworksSerializer. (diff)
parentRange Check on schematic size (diff)
downloadcuberite-a38d8b6513215a542cc0d450f95c90291b699d8e.tar
cuberite-a38d8b6513215a542cc0d450f95c90291b699d8e.tar.gz
cuberite-a38d8b6513215a542cc0d450f95c90291b699d8e.tar.bz2
cuberite-a38d8b6513215a542cc0d450f95c90291b699d8e.tar.lz
cuberite-a38d8b6513215a542cc0d450f95c90291b699d8e.tar.xz
cuberite-a38d8b6513215a542cc0d450f95c90291b699d8e.tar.zst
cuberite-a38d8b6513215a542cc0d450f95c90291b699d8e.zip
Diffstat (limited to 'src')
-rw-r--r--src/WorldStorage/MapSerializer.cpp8
-rw-r--r--src/WorldStorage/SchematicFileSerializer.cpp2
2 files changed, 9 insertions, 1 deletions
diff --git a/src/WorldStorage/MapSerializer.cpp b/src/WorldStorage/MapSerializer.cpp
index df72d1cc9..012fc52f3 100644
--- a/src/WorldStorage/MapSerializer.cpp
+++ b/src/WorldStorage/MapSerializer.cpp
@@ -152,6 +152,10 @@ bool cMapSerializer::LoadMapFromNBT(const cParsedNBT & a_NBT)
if (CurrLine >= 0)
{
unsigned int Width = a_NBT.GetShort(CurrLine);
+ if (Width != 128)
+ {
+ return false;
+ }
m_Map->m_Width = Width;
}
@@ -159,6 +163,10 @@ bool cMapSerializer::LoadMapFromNBT(const cParsedNBT & a_NBT)
if (CurrLine >= 0)
{
unsigned int Height = a_NBT.GetShort(CurrLine);
+ if (Height >= 256)
+ {
+ return false;
+ }
m_Map->m_Height = Height;
}
diff --git a/src/WorldStorage/SchematicFileSerializer.cpp b/src/WorldStorage/SchematicFileSerializer.cpp
index d3a708f92..1cf99efd9 100644
--- a/src/WorldStorage/SchematicFileSerializer.cpp
+++ b/src/WorldStorage/SchematicFileSerializer.cpp
@@ -192,7 +192,7 @@ bool cSchematicFileSerializer::LoadFromSchematicNBT(cBlockArea & a_BlockArea, cP
int SizeX = a_NBT.GetShort(TSizeX);
int SizeY = a_NBT.GetShort(TSizeY);
int SizeZ = a_NBT.GetShort(TSizeZ);
- if ((SizeX < 1) || (SizeY < 1) || (SizeZ < 1))
+ if ((SizeX < 1) || (SizeX > 65535) || (SizeY < 1) || (SizeY > 256) || (SizeZ < 1) || (SizeZ > 65535))
{
LOG("Dimensions are invalid in the schematic file: %d, %d, %d", SizeX, SizeY, SizeZ);
return false;