diff options
Diffstat (limited to 'src/WorldStorage/FastNBT.cpp')
-rw-r--r-- | src/WorldStorage/FastNBT.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/WorldStorage/FastNBT.cpp b/src/WorldStorage/FastNBT.cpp index 70570f7d0..1a81a6469 100644 --- a/src/WorldStorage/FastNBT.cpp +++ b/src/WorldStorage/FastNBT.cpp @@ -91,7 +91,7 @@ bool cParsedNBT::ReadString(size_t & a_StringStart, size_t & a_StringLen) NEEDBYTES(2); a_StringStart = m_Pos + 2; a_StringLen = static_cast<size_t>(GetBEShort(m_Data + m_Pos)); - NEEDBYTES(a_StringLen); + NEEDBYTES(2 + a_StringLen); m_Pos += 2 + a_StringLen; return true; } @@ -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) |