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

0030202: IntPatch_WLineTool::JoinWLines array out of bounds

The main idea of the fix is that the creation of WLine with one point is forbidden.
This commit is contained in:
nbv 2018-10-05 10:50:51 +03:00 committed by apn
parent dcf0889fc2
commit dcd768a49a
3 changed files with 86 additions and 2 deletions

View File

@ -3363,8 +3363,14 @@ static IntPatch_ImpImpIntersection::IntStatus
aP.SetTolerance(aTol3D);
aP.SetValue(aWLine[i]->Point(1).Value());
//Check whether the added point exists.
//It is enough to check the last point.
if (theSPnt.IsEmpty() ||
!theSPnt.Last().PntOn2S().IsSame(aP.PntOn2S(), Precision::Confusion()))
{
theSPnt.Append(aP);
}
}
else if (aWLine[i]->NbPnts() > 1)
{
Standard_Boolean isGood = Standard_True;
@ -3582,7 +3588,7 @@ static IntPatch_ImpImpIntersection::IntStatus
// another point in the interval [anUC, anUsup] if anUC is intersection point and
// in the interval [anUmid, anUC], otherwise.
Standard_Real anAddedPar[2] = { anUmid, anUmid };
Standard_Real anAddedPar[2] = {isReversed ? u2 : u1, isReversed ? u2 : u1};
for (Standard_Integer aParID = 0; aParID < 2; aParID++)
{

View File

@ -0,0 +1,64 @@
puts "========"
puts "0030202: IntPatch_WLineTool::JoinWLines array out of bounds"
puts "========"
puts ""
restore [locate_data_file bug30202_src.brep] b1
restore [locate_data_file bug30202_tool.brep] b2
bclearobjects
bcleartools
baddobjects b1
baddtools b2
bfillds
bbop r_0 0
bbop r_1 1
bbop r_2 2
bbop r_3 3
bbop r_4 4
checkshape r_0
checknbshapes r_0 -solid 1 -shell 1 -face 10 -wire 10
checkprops r_0 -s 3.07923 -v 0.15225
if {[regexp "Faulties" [bopargcheck r_0]]} {
puts "Error: bopargcheck has found some faulties in r_0"
}
checkshape r_1
checknbshapes r_1 -solid 1 -shell 1 -face 31 -wire 33
checkprops r_1 -s 128.978 -v 46.7138
if {[regexp "Faulties" [bopargcheck r_1]]} {
puts "Error: bopargcheck has found some faulties in r_1"
}
checkshape r_2
checknbshapes r_2 -solid 1 -shell 1 -face 29 -wire 31
checkprops r_2 -s 117.75 -v 45.3505
if {[regexp "Faulties" [bopargcheck r_2]]} {
puts "Error: bopargcheck has found some faulties in r_2"
}
checkshape r_3
checknbshapes r_3 -solid 1 -shell 1 -face 12 -wire 12
checkprops r_3 -s 14.3071 -v 1.2111
if {[regexp "Faulties" [bopargcheck r_3]]} {
puts "Error: bopargcheck has found some faulties in r_3"
}
checkshape r_4
checknbshapes r_4 -vertex 8 -edge 8
checkprops r_4 -l 8.28981
if {[regexp "Faulties" [bopargcheck r_4]]} {
puts "Error: bopargcheck has found some faulties in r_4"
}
checksection r_4 -r 0
# FUSE
copy r_1 result
checkmaxtol result -min_tol 1.0e-4
checkview -display result -2d -path ${imagedir}/${test_image}.png

View File

@ -0,0 +1,14 @@
puts "========"
puts "0030202: IntPatch_WLineTool::JoinWLines array out of bounds"
puts "========"
puts ""
restore [locate_data_file bug30202_src.brep] b1
restore [locate_data_file bug30202_tool.brep] b2
explode b1 f
explode b2 f
if {![regexp "no 3d curves\n has no 3d points" [bopcurves b1_5 b2_7 -2d]]} {
puts "Error: Expected intersection result is empty"
}