Kim Kulling 4 hónapja
szülő
commit
327afe0183
2 módosított fájl, 8 hozzáadás és 4 törlés
  1. 5 2
      code/AssetLib/ASE/ASEParser.cpp
  2. 3 2
      code/AssetLib/CSM/CSMLoader.cpp

+ 5 - 2
code/AssetLib/ASE/ASEParser.cpp

@@ -1406,10 +1406,13 @@ void Parser::ParseLV4MeshBonesVertices(unsigned int iNumVertices, ASE::Mesh &mes
             if (TokenMatch(mFilePtr, "MESH_BONE_VERTEX", 16)) {
                 // read the vertex index
                 unsigned int iIndex = strtoul10(mFilePtr, &mFilePtr);
-                if (iIndex >= mesh.mBoneVertices.size()) {
-                    iIndex = (unsigned int)mesh.mBoneVertices.size() - 1;
+                if (mesh.mBoneVertices.empty()) {
+                    SkipSection();
+                }
+                if (iIndex >= mesh.mBoneVertices.size() ) {
                     LogWarning("Bone vertex index is out of bounds. Using the largest valid "
                                "bone vertex index instead");
+                    iIndex = (unsigned int)mesh.mBoneVertices.size() - 1;
                 }
 
                 // --- ignored

+ 3 - 2
code/AssetLib/CSM/CSMLoader.cpp

@@ -150,8 +150,9 @@ void CSMImporter::InternReadFile( const std::string& pFile,
                     anims_temp.push_back(new aiNodeAnim());
                     aiNodeAnim* nda = anims_temp.back();
 
-                    char* ot = nda->mNodeName.data;
-                    while (!IsSpaceOrNewLine(*buffer) && buffer != end) {
+                    char *ot = nda->mNodeName.data;
+                    const char *ot_end = nda->mNodeName.data + AI_MAXLEN;
+                    while (!IsSpaceOrNewLine(*buffer) && buffer != end && ot != ot_end) {
                         *ot++ = *buffer++;
                     }