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

0025175: avoid unsafe 3D curve usages

Test case for issue CR25175
This commit is contained in:
drazmyslovich 2014-09-18 15:53:05 +04:00 committed by bugmaster
parent 9bf6baed3c
commit de10d8b144
2 changed files with 24 additions and 6 deletions

View File

@ -1057,6 +1057,7 @@ void BRepBuilderAPI_Sewing::EvaluateDistances(TopTools_SequenceOfShape& sequence
TopLoc_Location loc;
Standard_Real first, last;
Handle(Geom_Curve) c3d = BRep_Tool::Curve(sec, loc, first, last);
if (c3d.IsNull()) continue;
if (!loc.IsIdentity()) {
c3d = Handle(Geom_Curve)::DownCast(c3d->Copy());
c3d->Transform(loc.Transformation());
@ -3604,15 +3605,16 @@ void BRepBuilderAPI_Sewing::Cutting(const Handle(Message_ProgressIndicator)& the
const TopoDS_Edge& bound = TopoDS::Edge(myBoundFaces.FindKey(i));
// Do not cut floating edges
if (!myBoundFaces(i).Extent()) continue;
// Obtain bound curve
c3d = BRep_Tool::Curve(bound, loc, first, last);
if (c3d.IsNull()) continue;
if (!loc.IsIdentity()) {
c3d = Handle(Geom_Curve)::DownCast(c3d->Copy());
c3d->Transform(loc.Transformation());
}
// Create cutting sections
TopTools_ListOfShape listSections;
{ //szv: Use brackets to destroy local variables
// Obtain bound curve
c3d = BRep_Tool::Curve(bound, loc, first, last);
if (!loc.IsIdentity()) {
c3d = Handle(Geom_Curve)::DownCast(c3d->Copy());
c3d->Transform(loc.Transformation());
}
// Obtain candidate vertices
TopoDS_Vertex V1, V2;
TopTools_IndexedMapOfShape CandidateVertices;

View File

@ -0,0 +1,16 @@
puts "============"
puts "OCC25175"
puts "============"
puts ""
###########################################################################
# BRepBuilderAPI_Sewing can crash if an edge without 3D curve is presented
###########################################################################
pload XSDRAW
igesread [locate_data_file bug25175_3.igs] a *
sewing result 0.1 a
set 2dviewer 1