MDL: Fix read past end of buffer with malformed input

pull/632/head
Turo Lamminen 2015-08-11 14:32:26 +03:00
parent 2a432f9adc
commit 4cc716a0f5
1 changed files with 3 additions and 0 deletions

View File

@ -355,6 +355,9 @@ void MDLImporter::InternReadFile_Quake1( )
for (unsigned int i = 0; i < (unsigned int)pcHeader->num_skins;++i)
{
union{BE_NCONST MDL::Skin* pcSkin;BE_NCONST MDL::GroupSkin* pcGroupSkin;};
if (szCurrent + sizeof(MDL::Skin) > this->mBuffer + this->iFileSize) {
throw DeadlyImportError("[Quake 1 MDL] Unexpected EOF");
}
pcSkin = (BE_NCONST MDL::Skin*)szCurrent;
AI_SWAP4( pcSkin->group );