Fix integer overflow

- closes https://github.com/assimp/assimp/issues/4930
pull/5401/head
Kim Kulling 2023-12-22 11:57:43 +01:00
parent 9dddef9b9d
commit 69dae9599a
1 changed files with 2 additions and 3 deletions

View File

@ -123,9 +123,8 @@ aiColor4D MDLImporter::ReplaceTextureWithColor(const aiTexture *pcTexture) {
// Read a texture from a MDL3 file // Read a texture from a MDL3 file
void MDLImporter::CreateTextureARGB8_3DGS_MDL3(const unsigned char *szData) { void MDLImporter::CreateTextureARGB8_3DGS_MDL3(const unsigned char *szData) {
const MDL::Header *pcHeader = (const MDL::Header *)mBuffer; //the endianness is already corrected in the InternReadFile_3DGS_MDL345 function const MDL::Header *pcHeader = (const MDL::Header *)mBuffer; //the endianness is already corrected in the InternReadFile_3DGS_MDL345 function
const size_t len = pcHeader->skinwidth * pcHeader->skinheight);
VALIDATE_FILE_SIZE(szData + pcHeader->skinwidth * VALIDATE_FILE_SIZE(szData + len);
pcHeader->skinheight);
// allocate a new texture object // allocate a new texture object
aiTexture *pcNew = new aiTexture(); aiTexture *pcNew = new aiTexture();