Ver código fonte

STL: Fix another read past EOF

Turo Lamminen 10 anos atrás
pai
commit
e5ddb98dde
1 arquivos alterados com 6 adições e 0 exclusões
  1. 6 0
      code/STLLoader.cpp

+ 6 - 0
code/STLLoader.cpp

@@ -304,6 +304,9 @@ void STLImporter::LoadASCIIFile()
                 }
                 else
                 {
+                    if (sz[6] == '\0') {
+                        throw DeadlyImportError("STL: unexpected EOF while parsing facet");
+                    }
                     sz += 7;
                     SkipSpaces(&sz);
                     sz = fast_atoreal_move<float>(sz, (float&)vn->x );
@@ -324,6 +327,9 @@ void STLImporter::LoadASCIIFile()
                 }
                 else
                 {
+                    if (sz[6] == '\0') {
+                        throw DeadlyImportError("STL: unexpected EOF while parsing facet");
+                    }
                     sz += 7;
                     SkipSpaces(&sz);
                     positionBuffer.push_back(aiVector3D());