Browse Source

FBX: Fix offset calculation by adding cursor check (#6337)

- closes https://github.com/assimp/assimp/issues/6336
Kim Kulling 3 weeks ago
parent
commit
8ef3838beb
1 changed files with 3 additions and 1 deletions
  1. 3 1
      code/AssetLib/FBX/FBXBinaryTokenizer.cpp

+ 3 - 1
code/AssetLib/FBX/FBXBinaryTokenizer.cpp

@@ -91,7 +91,9 @@ AI_WONT_RETURN void TokenizeError(const std::string& message, size_t offset)
 
 // ------------------------------------------------------------------------------------------------
 size_t Offset(const char* begin, const char* cursor) {
-    ai_assert(begin <= cursor);
+    if (begin > cursor) {
+		return 0;
+	}
 
     return cursor - begin;
 }