1
0

Check for invalid tags when reading a compound tag

This commit is contained in:
tycho 2015-12-17 22:34:19 +00:00 committed by Mattes D
parent 749274aa43
commit 456253c651

View File

@ -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)