Browse Source

Fix Heap-buffer-overflow READ in Assimp::ObjFileParser::getFace

Alex 2 years ago
parent
commit
c3e69b5b82
1 changed files with 2 additions and 2 deletions
  1. 2 2
      code/AssetLib/Obj/ObjFileParser.cpp

+ 2 - 2
code/AssetLib/Obj/ObjFileParser.cpp

@@ -456,8 +456,8 @@ void ObjFileParser::getFace(aiPrimitiveType type) {
             iPos = 0;
             iPos = 0;
         } else {
         } else {
             //OBJ USES 1 Base ARRAYS!!!!
             //OBJ USES 1 Base ARRAYS!!!!
-            const char *token = &(*m_DataIt);
-            const int iVal = ::atoi(token);
+            std::string number(&(*m_DataIt), m_DataItEnd - m_DataIt);
+            const int iVal(::atoi(number.c_str()));
 
 
             // increment iStep position based off of the sign and # of digits
             // increment iStep position based off of the sign and # of digits
             int tmp = iVal;
             int tmp = iVal;