Browse Source

Fix out of bounds access in X3D loader

Turo Lamminen 3 years ago
parent
commit
654ae3af4e
1 changed files with 4 additions and 4 deletions
  1. 4 4
      code/AssetLib/X3D/X3DImporter_Geometry2D.cpp

+ 4 - 4
code/AssetLib/X3D/X3DImporter_Geometry2D.cpp

@@ -274,10 +274,10 @@ void X3DImporter::readDisk2D(XmlNode &node) {
             }
             }
 
 
             // add last quad
             // add last quad
-            vlist.push_back(*tlist_i.end()); // 1st point
-            vlist.push_back(*tlist_o.end()); // 2nd point
-            vlist.push_back(*tlist_o.begin()); // 3rd point
-            vlist.push_back(*tlist_o.begin()); // 4th point
+            vlist.push_back(tlist_i.back()); // 1st point
+            vlist.push_back(tlist_o.back()); // 2nd point
+            vlist.push_back(tlist_o.front()); // 3rd point
+            vlist.push_back(tlist_o.front()); // 4th point
 
 
             ((X3DNodeElementGeometry2D *)ne)->NumIndices = 4;
             ((X3DNodeElementGeometry2D *)ne)->NumIndices = 4;
         }
         }