Change string validation to suit the new binary layout.

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@607 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
pull/1/head
aramis_acg 2010-03-13 17:14:59 +00:00
parent 07a5daa799
commit 46d56ff619
1 changed files with 8 additions and 3 deletions

View File

@ -663,13 +663,18 @@ 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 < 5 || prop->mDataLength < 4 + *reinterpret_cast<uint32_t*>(prop->mData) + 1) {
// FIX: strings are now stored in a less expensive way, but we can't use the
// validation routine for 'normal' aiStrings
uint32_t len;
if (prop->mDataLength < 5 || prop->mDataLength < 4 + (len=*reinterpret_cast<uint32_t*>(prop->mData)) + 1) {
ReportError("aiMaterial::mProperties[%i].mDataLength is "
"too small to contain a string (%i, needed: %i)",
i,prop->mDataLength,sizeof(aiString));
}
Validate((const aiString*)prop->mData);
if(prop->mData[prop->mDataLength-1]) {
ReportError("Missing null-terminator in string material property");
}
// Validate((const aiString*)prop->mData);
}
else if (aiPTI_Float == prop->mType) {
if (prop->mDataLength < sizeof(float)) {