1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-04 18:06:22 +03:00

0024675: Crash reading a VRML file

A node index for a normal is passed through a map of corrected references to node indices.

Test case for issue CR24675
This commit is contained in:
vro 2014-03-06 14:48:36 +04:00 committed by abv
parent 93cb31a607
commit 5064550f11
8 changed files with 22 additions and 6 deletions

View File

@ -193,7 +193,7 @@ const Handle(TopoDS_TShape)& VrmlData_IndexedFaceSet::TShape ()
if (IndiceNormals(i, arrIndice) == 3) {
for (Standard_Integer j = 0; j < 3; j++) {
const gp_XYZ& aNormal = myNormals->Normal (arrIndice[j]);
Standard_Integer anInd = arrNodes[j] * 3 + 1;
Standard_Integer anInd = (mapNodeId(arrNodes[j]) - 1) * 3 + 1;
Normals->SetValue (anInd + 0, Standard_ShortReal (aNormal.X()));
Normals->SetValue (anInd + 1, Standard_ShortReal (aNormal.Y()));
Normals->SetValue (anInd + 2, Standard_ShortReal (aNormal.Z()));

View File

@ -163,6 +163,10 @@ if { [isdraw result] } {
if { [info exists 3dviewer] } {
#for multiview support: dump result from all opened views
set view_str [vviewlist long]
if { [llength ${view_str}] == 0 } {
vinit
set view_str [vviewlist long]
}
set view_list [regexp -all -inline {\S+} $view_str]
foreach {view_name} $view_list {
vactivate $view_name

View File

@ -15,3 +15,4 @@
015 caf
016 mesh
017 heal
018 stlvrml

3
tests/bugs/stlvrml/begin Executable file
View File

@ -0,0 +1,3 @@
pload XSDRAW
set subgroup stlvrml

View File

@ -6,8 +6,6 @@ puts ""
# Crash of application on attempt to load a VRML file with all degenerated triangles
######################################################################################
set BugNumber OCC22092
loadvrml result [locate_data_file OCC22092-sk97.wrl]
set nb_v_good 16

View File

@ -6,12 +6,11 @@ puts ""
# VRML reader fails on attempt to read an attached WRL file
#######################################################################
set BugNumber OCC23023
pload XDE
set filepath [locate_data_file OCC23023-2056132060_2_tutnicht.wrl]
if [catch { set list [loadvrml result $filepath] } res] {
puts "Faulty: VRML reader fails"
} else {
puts "OK: VRML reader work properly"
}
set 3dviewer 1

View File

@ -0,0 +1,11 @@
puts "========================"
puts "OCC24675"
puts "========================"
puts ""
#######################################################################
# Crash reading a VRML file
#######################################################################
loadvrml result [locate_data_file T00111111_0000.wrl]
set 3dviewer 1