浏览代码

Merge pull request #629 from turol/afl-fixes

Avoid reading past EOF when encountering a malformed STL file
Kim Kulling 10 年之前
父节点
当前提交
4cc67a3ccc
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      code/STLLoader.cpp

+ 1 - 1
code/STLLoader.cpp

@@ -279,7 +279,7 @@ void STLImporter::LoadASCIIFile()
             break;
         }
         // facet normal -0.13 -0.13 -0.98
-        if (!strncmp(sz,"facet",5) && IsSpaceOrNewLine(*(sz+5)))    {
+        if (!strncmp(sz,"facet",5) && IsSpaceOrNewLine(*(sz+5)) && *(sz + 5) != '\0')    {
 
             if (3 != curVertex) {
                 DefaultLogger::get()->warn("STL: A new facet begins but the old is not yet complete");