From 37ec378b60b3db5810e6f4de2f9f509acdacdca6 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Wed, 27 Apr 2022 19:52:23 +0200 Subject: [PATCH 1/2] Fixx out-of-range access in ASE-Parser - closes https://github.com/assimp/assimp/issues/4495 --- code/AssetLib/ASE/ASEParser.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/code/AssetLib/ASE/ASEParser.cpp b/code/AssetLib/ASE/ASEParser.cpp index 14eb720f4..9e2d301e8 100644 --- a/code/AssetLib/ASE/ASEParser.cpp +++ b/code/AssetLib/ASE/ASEParser.cpp @@ -646,7 +646,9 @@ void Parser::ParseLV2MaterialBlock(ASE::Material &mat) { } // get a reference to the material - Material &sMat = mat.avSubMaterials[iIndex]; + if (iIndex < mat.avSubMaterials.size()) { + Material &sMat = mat.avSubMaterials[iIndex]; + } // parse the material block ParseLV2MaterialBlock(sMat); From 174b2fcf595a22af1ac6dcfa009ca5e7fcb8435e Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Wed, 27 Apr 2022 20:21:30 +0200 Subject: [PATCH 2/2] Fix invalid use of material reference. --- code/AssetLib/ASE/ASEParser.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/code/AssetLib/ASE/ASEParser.cpp b/code/AssetLib/ASE/ASEParser.cpp index 9e2d301e8..0d526147c 100644 --- a/code/AssetLib/ASE/ASEParser.cpp +++ b/code/AssetLib/ASE/ASEParser.cpp @@ -648,10 +648,11 @@ void Parser::ParseLV2MaterialBlock(ASE::Material &mat) { // get a reference to the material if (iIndex < mat.avSubMaterials.size()) { Material &sMat = mat.avSubMaterials[iIndex]; + + // parse the material block + ParseLV2MaterialBlock(sMat); } - // parse the material block - ParseLV2MaterialBlock(sMat); continue; } }