From 54b0c00418a7084c64ab74542abb3ef10012cfee Mon Sep 17 00:00:00 2001 From: Alex Date: Sat, 3 Jun 2023 20:28:37 +0000 Subject: [PATCH] Fix UNKNOWN READ in Assimp::MDLImporter::ParseSkinLump_3DGS_MDL7 --- code/AssetLib/MDL/MDLMaterialLoader.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/code/AssetLib/MDL/MDLMaterialLoader.cpp b/code/AssetLib/MDL/MDLMaterialLoader.cpp index fbda40151..bcd5f1d70 100644 --- a/code/AssetLib/MDL/MDLMaterialLoader.cpp +++ b/code/AssetLib/MDL/MDLMaterialLoader.cpp @@ -481,6 +481,10 @@ void MDLImporter::ParseSkinLump_3DGS_MDL7( pcNew->achFormatHint[2] = 's'; pcNew->achFormatHint[3] = '\0'; + if (szCurrent + pcNew->mWidth > this->mBuffer + this->iFileSize) { + throw DeadlyImportError("Invalid MDL file. Unexpected EOF"); + } + pcNew->pcData = (aiTexel *)new unsigned char[pcNew->mWidth]; memcpy(pcNew->pcData, szCurrent, pcNew->mWidth); szCurrent += iWidth;