Fix a fuzz test heap buffer overflow in mdl material loader

pull/5658/head
Stoyan Gaydarov 2024-07-08 17:09:14 +00:00
parent 35e4f1bf64
commit a2bcc27ccd
1 changed files with 2 additions and 0 deletions

View File

@ -730,10 +730,12 @@ void MDLImporter::SkipSkinLump_3DGS_MDL7(
// if an ASCII effect description (HLSL?) is contained in the file,
// we can simply ignore it ...
if (iType & AI_MDL7_SKINTYPE_MATERIAL_ASCDEF) {
VALIDATE_FILE_SIZE(szCurrent + sizeof(int32_t));
int32_t iMe = 0;
::memcpy(&iMe, szCurrent, sizeof(int32_t));
AI_SWAP4(iMe);
szCurrent += sizeof(char) * iMe + sizeof(int32_t);
VALIDATE_FILE_SIZE(szCurrent);
}
*szCurrentOut = szCurrent;
}