From 07a5daa79984798e62ee4ac291a2bc605e0530cd Mon Sep 17 00:00:00 2001 From: aramis_acg Date: Sat, 13 Mar 2010 17:03:13 +0000 Subject: [PATCH] Fix validation of string material properties in the aiProcess_ValidateDataStructure process. git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@606 67173fc5-114c-0410-ac8e-9d2fd5bffc1f --- code/ValidateDataStructure.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/ValidateDataStructure.cpp b/code/ValidateDataStructure.cpp index 6149e53f2..dc76ae225 100644 --- a/code/ValidateDataStructure.cpp +++ b/code/ValidateDataStructure.cpp @@ -664,7 +664,7 @@ void ValidateDSProcess::Validate( const aiMaterial* pMaterial) // check all predefined types if (aiPTI_String == prop->mType) { // FIX: strings are now stored in a less expensive way ... - if (prop->mDataLength < sizeof(size_t) + ((const aiString*)prop->mData)->length + 1) { + if (prop->mDataLength < 5 || prop->mDataLength < 4 + *reinterpret_cast(prop->mData) + 1) { ReportError("aiMaterial::mProperties[%i].mDataLength is " "too small to contain a string (%i, needed: %i)", i,prop->mDataLength,sizeof(aiString));