Răsfoiți Sursa

Fix out-of-bounds read in ReadFirstSkin

Fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=25401
Alex Rebert 3 ani în urmă
părinte
comite
107371657b
1 a modificat fișierele cu 1 adăugiri și 0 ștergeri
  1. 1 0
      code/AssetLib/HMP/HMPLoader.cpp

+ 1 - 0
code/AssetLib/HMP/HMPLoader.cpp

@@ -451,6 +451,7 @@ void HMPImporter::ReadFirstSkin(unsigned int iNumSkins, const unsigned char *szC
 
 
     // now we need to skip any other skins ...
     // now we need to skip any other skins ...
     for (unsigned int i = 1; i < iNumSkins; ++i) {
     for (unsigned int i = 1; i < iNumSkins; ++i) {
+        SizeCheck(szCursor + 3 * sizeof(uint32_t));
         iType = *((uint32_t *)szCursor);
         iType = *((uint32_t *)szCursor);
         szCursor += sizeof(uint32_t);
         szCursor += sizeof(uint32_t);
         iWidth = *((uint32_t *)szCursor);
         iWidth = *((uint32_t *)szCursor);