Anonymous | Login | 2021-01-17 18:48 MSK | ![]() |
My View | View Issues | Change Log | Roadmap |
View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||||||
0031601 | Community | [OCCT] OCCT:Modeling Algorithms | public | 2020-06-07 17:50 | 2020-06-07 17:50 | ||||||||
Reporter | abdullah | ||||||||||||
Assigned To | msv | ||||||||||||
Priority | normal | Severity | crash | ||||||||||
Status | new | Resolution | open | ||||||||||
Platform | Linux | OS | Debian 6.0 | OS Version | 64 bit | ||||||||
Product Version | [OCCT] 7.3.0 | ||||||||||||
Target Version | Fixed in Version | ||||||||||||
Summary | 0031601: BRepOffset_Tool - Segmentation Fault | ||||||||||||
Description | A patch as possible solution is provided. This has been tested and reproduced against development branch 7.4.1, commit ae58f70718a089f84178d45a1bf9bee586d52d80 This bug is based on the FreeCAD bug: https://tracker.freecadweb.org/view.php?id=2325 [^] The segmentation fault happens in function BRepOffset_Tool::TryProject. In the following code (starting in line 1815): TopoDS_Edge CurE = TopoDS::Edge(it.Value()); Handle(Geom_Curve) C = BRep_Tool::Curve(CurE,L,f,l); if (C.IsNull()) { BRepLib::BuildCurve3d(CurE,BRep_Tool::Tolerance(CurE)); C = BRep_Tool::Curve(CurE,L,f,l); } C = new Geom_TrimmedCurve(C,f,l); The curve produced by the call to BRep_Tool::Curve(CurE,L,f,l) is null. Consequently the curve inserted into the constructor of Geom_TrimmedCurve is null. This causes the segfault. I do not know whether BuildCurve3d is faulty (it should necessarily provide a non-null curve or not). I only know that in this specific case, it produces a null curve. A possible solution to avoid the segmentation fault (see patch below), is to test whether the curve produced by BuildCurve3d is null. An alternative to returning Standard_False (as in the patch) is to raise an exception. As no other function of this class raises an exception. None of the other functions of this class returns an exception, this my unqualified reason for returning Standard_False instead. You know the code better than me and may prefer an exception instead. | ||||||||||||
Steps To Reproduce | This bug is based on the FreeCAD bug: https://tracker.freecadweb.org/view.php?id=2325 [^] It is not easy to provide a way to reproduce it without FreeCAD. I am running a setup using a locally build FreeCAD with a locally build development branch of OCCT: https://forum.freecadweb.org/viewtopic.php?f=10&t=47017&start=10#p405952 [^] I think that based on the analysis above, you will be interested in preventing the segfault. Of course, if you want to provide other code and would like me to test a possible patch or else, just contact me. I am ready to help. | ||||||||||||
Additional information and documentation updates | This is a patch that prevents the segmentation fault. diff --git a/src/BRepOffset/BRepOffset_Tool.cxx b/src/BRepOffset/BRepOffset_Tool.cxx index af3ac106e1..b7c0d2310c 100644 --- a/src/BRepOffset/BRepOffset_Tool.cxx +++ b/src/BRepOffset/BRepOffset_Tool.cxx @@ -1820,0 +1821,3 @@ Standard_Boolean BRepOffset_Tool::TryProject + if (C.IsNull()) + return Standard_False; + | ||||||||||||
Tags | No tags attached. | ||||||||||||
Test case number | |||||||||||||
Attached Files | |||||||||||||
![]() |
|||
Date Modified | Username | Field | Change |
2020-06-07 17:50 | abdullah | New Issue | |
2020-06-07 17:50 | abdullah | Assigned To | => msv |
Copyright © 2000 - 2021 MantisBT Team |