mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-21 10:13:43 +03:00
0024176: Array out-of-bound error in Vrml loader (test bugs moddata_3 bug23023)
Code assigning normals to nodes of triangulation corrected to use correct index of the node and avoid array out-of-bound errors.
This commit is contained in:
parent
b4109929d6
commit
cccf81ea2a
@ -173,22 +173,23 @@ const Handle(TopoDS_TShape)& VrmlData_IndexedFaceSet::TShape ()
|
|||||||
Normals->SetValue (anIdx + 1, Standard_ShortReal (aNormal.Y ()));
|
Normals->SetValue (anIdx + 1, Standard_ShortReal (aNormal.Y ()));
|
||||||
Normals->SetValue (anIdx + 2, Standard_ShortReal (aNormal.Z ()));
|
Normals->SetValue (anIdx + 2, Standard_ShortReal (aNormal.Z ()));
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
nTri = 0;
|
else
|
||||||
for (i = 0; i < (int)myNbPolygons; i++) {
|
{
|
||||||
|
for (i = 0; i < (int)myNbPolygons; i++)
|
||||||
|
{
|
||||||
|
const Standard_Integer * arrNodes;
|
||||||
|
if (Polygon(i, arrNodes) == 3 && arrNodes[0] >= 0) // check to avoid previously skipped faces
|
||||||
|
{
|
||||||
const Standard_Integer * arrIndice;
|
const Standard_Integer * arrIndice;
|
||||||
if (Polygon(i, arrIndice) == 3)
|
|
||||||
if (arrIndice[0] >= 0) // check to avoid previously skipped faces
|
|
||||||
if (IndiceNormals(i, arrIndice) == 3) {
|
if (IndiceNormals(i, arrIndice) == 3) {
|
||||||
Standard_Integer anInd = (++nTri - 1) * 3 + 1;
|
|
||||||
for (Standard_Integer j = 0; j < 3; j++) {
|
for (Standard_Integer j = 0; j < 3; j++) {
|
||||||
const gp_XYZ& aNormal = myNormals->Normal (arrIndice[j]);
|
const gp_XYZ& aNormal = myNormals->Normal (arrIndice[j]);
|
||||||
Normals->SetValue (anInd + 0 + j*3,
|
Standard_Integer anInd = arrNodes[j] * 3 + 1;
|
||||||
Standard_ShortReal (aNormal.X ()));
|
Normals->SetValue (anInd + 0, Standard_ShortReal (aNormal.X()));
|
||||||
Normals->SetValue (anInd + 1 + j*3,
|
Normals->SetValue (anInd + 1, Standard_ShortReal (aNormal.Y()));
|
||||||
Standard_ShortReal (aNormal.Y ()));
|
Normals->SetValue (anInd + 2, Standard_ShortReal (aNormal.Z()));
|
||||||
Normals->SetValue (anInd + 2 + j*3,
|
}
|
||||||
Standard_ShortReal (aNormal.Z ()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,3 @@
|
|||||||
puts "TODO ?OCC12345 ALL: An exception was caught"
|
|
||||||
puts "TODO ?OCC12345 ALL: \\*\\* Exception \\*\\*.*"
|
|
||||||
puts "TODO ?OCC12345 ALL: Faulty: VRML reader fails"
|
|
||||||
##puts "TODO ?OCC12345 ALL: TEST INCOMPLETE"
|
|
||||||
|
|
||||||
puts "========================"
|
puts "========================"
|
||||||
puts "OCC23023"
|
puts "OCC23023"
|
||||||
puts "========================"
|
puts "========================"
|
||||||
@ -20,10 +15,3 @@ if [catch { set list [loadvrml result $filepath] } res] {
|
|||||||
} else {
|
} else {
|
||||||
puts "OK: VRML reader work properly"
|
puts "OK: VRML reader work properly"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user