diff options
author | Alexander Harkness <me@bearbin.net> | 2015-12-18 15:40:23 +0100 |
---|---|---|
committer | Alexander Harkness <me@bearbin.net> | 2015-12-18 15:40:23 +0100 |
commit | 05e39b249b4f89207f92e169701b7eb9d87a1c62 (patch) | |
tree | 44d45134caab888386e5fa7ba2935ac197eb3ed8 /src/WorldStorage | |
parent | Merge pull request #2759 from cuberite/ExplosionAPI (diff) | |
parent | Check for invalid tags when reading a compound tag (diff) | |
download | cuberite-05e39b249b4f89207f92e169701b7eb9d87a1c62.tar cuberite-05e39b249b4f89207f92e169701b7eb9d87a1c62.tar.gz cuberite-05e39b249b4f89207f92e169701b7eb9d87a1c62.tar.bz2 cuberite-05e39b249b4f89207f92e169701b7eb9d87a1c62.tar.lz cuberite-05e39b249b4f89207f92e169701b7eb9d87a1c62.tar.xz cuberite-05e39b249b4f89207f92e169701b7eb9d87a1c62.tar.zst cuberite-05e39b249b4f89207f92e169701b7eb9d87a1c62.zip |
Diffstat (limited to '')
-rw-r--r-- | src/WorldStorage/FastNBT.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/WorldStorage/FastNBT.cpp b/src/WorldStorage/FastNBT.cpp index 70570f7d0..a90db2b71 100644 --- a/src/WorldStorage/FastNBT.cpp +++ b/src/WorldStorage/FastNBT.cpp @@ -110,7 +110,12 @@ bool cParsedNBT::ReadCompound(void) for (;;) { NEEDBYTES(1); - eTagType TagType = static_cast<eTagType>(m_Data[m_Pos]); + const char TagTypeNum = m_Data[m_Pos]; + if ((TagTypeNum < TAG_Min) || (TagTypeNum > TAG_Max)) + { + return false; + } + eTagType TagType = static_cast<eTagType>(TagTypeNum); m_Pos++; if (TagType == TAG_End) { @@ -258,7 +263,6 @@ bool cParsedNBT::ReadTag(void) #endif case TAG_Min: { - ASSERT(!"Unhandled NBT tag type"); return false; } } // switch (iType) |