瀏覽代碼

Fix array access when loading colored binary STLs

Loading binary STLs with colors caused a crash due to writing after the end of the colors array.
Nicholas Bishop 12 年之前
父節點
當前提交
c2db6a0abd
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      code/STLLoader.cpp

+ 1 - 1
code/STLLoader.cpp

@@ -382,7 +382,7 @@ bool STLImporter::LoadBinaryFile()
 
 
 				DefaultLogger::get()->info("STL: Mesh has vertex colors");
 				DefaultLogger::get()->info("STL: Mesh has vertex colors");
 			}
 			}
-			aiColor4D* clr = &pMesh->mColors[0][pMesh->mNumFaces*3];
+			aiColor4D* clr = &pMesh->mColors[0][i*3];
 			clr->a = 1.0f;
 			clr->a = 1.0f;
 			if (bIsMaterialise) // fuck, this is reversed
 			if (bIsMaterialise) // fuck, this is reversed
 			{
 			{