diff --git a/code/AssetLib/ASE/ASEParser.cpp b/code/AssetLib/ASE/ASEParser.cpp index badfcec76..1f7c3c938 100644 --- a/code/AssetLib/ASE/ASEParser.cpp +++ b/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 diff --git a/code/AssetLib/CSM/CSMLoader.cpp b/code/AssetLib/CSM/CSMLoader.cpp index 11e52e029..6ea3f8ef9 100644 --- a/code/AssetLib/CSM/CSMLoader.cpp +++ b/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++; }