浏览代码

MDL: Fix read past end of buffer with malformed input

Turo Lamminen 10 年之前
父节点
当前提交
4cc716a0f5
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      code/MDLLoader.cpp

+ 3 - 0
code/MDLLoader.cpp

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