Skip to content

Commit

Permalink
Merge pull request #5127 from sashashura/5921493454815232
Browse files Browse the repository at this point in the history
Fix Bad-cast to Assimp::D3DS::Material from invalid vptr in Assimp::ASE::Parser::ParseLV2MaterialBlock
  • Loading branch information
kimkulling committed Jun 27, 2023
2 parents 8937248 + db6c1a8 commit d2411a7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions code/AssetLib/ASE/ASEParser.cpp
Expand Up @@ -479,6 +479,11 @@ void Parser::ParseLV1MaterialListBlock() {
if (TokenMatch(filePtr, "MATERIAL_COUNT", 14)) {
ParseLV4MeshLong(iMaterialCount);

if (UINT_MAX - iOldMaterialCount < iMaterialCount) {
LogWarning("Out of range: material index is too large");
return;
}

// now allocate enough storage to hold all materials
m_vMaterials.resize(iOldMaterialCount + iMaterialCount, Material("INVALID"));
continue;
Expand Down

0 comments on commit d2411a7

Please sign in to comment.