Browse Source

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
aramis_acg 15 years ago
parent
commit
07a5daa799
1 changed files with 1 additions and 1 deletions
  1. 1 1
      code/ValidateDataStructure.cpp

+ 1 - 1
code/ValidateDataStructure.cpp

@@ -664,7 +664,7 @@ void ValidateDSProcess::Validate( const aiMaterial* pMaterial)
 		// check all predefined types
 		// check all predefined types
 		if (aiPTI_String == prop->mType)	{
 		if (aiPTI_String == prop->mType)	{
 			// FIX: strings are now stored in a less expensive way ...
 			// 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<uint32_t*>(prop->mData) + 1)	{
 				ReportError("aiMaterial::mProperties[%i].mDataLength is "
 				ReportError("aiMaterial::mProperties[%i].mDataLength is "
 					"too small to contain a string (%i, needed: %i)",
 					"too small to contain a string (%i, needed: %i)",
 					i,prop->mDataLength,sizeof(aiString));
 					i,prop->mDataLength,sizeof(aiString));