View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0031601 | Community | OCCT:Modeling Algorithms | public | 2020-06-07 17:50 | 2024-04-08 19:28 |
Reporter | abdullah | Assigned To | astromko | ||
Priority | normal | Severity | crash | ||
Status | verified | Resolution | fixed | ||
Platform | Linux | OS | Debian 6.0 | ||
Product Version | 7.3.0 | ||||
Target Version | Unscheduled | ||||
Summary | 0031601: Modeling Algorithms - 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 | box b 50 50 10 explode b E compound b_1 b_2 b_3 b_4 b_5 b_6 b_7 b_8 b_9 b_10 b_11 b_12 c fillet s b 4 c explode s F offsetparameter 1.e-7 c a offsetload s 1 s_11 offsetperform r # OSD_Exception_ACCESS_VIOLATION: ACCESS VIOLATION at address 0x0000000000000000 during 'READ' operation 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 | |||||
|
Dear abdullah, It would help a lot in reproduction and fixing this bug if you provided a piece of isolated code that causes this bug. It will be OK if it will be a complete program with main() function doing all stuff. |
|
Needs to analyze on latest version. If be able to reproduce - needs to fix. |
|
Branch CR31601 has been created by Aleksei_S. SHA-1: fe7ca7662a987ce2b197ef17058500ca17d88181 Detailed log of new commits: Author: aleksei.stromkov Date: Thu Feb 8 17:02:45 2024 +0000 0031601: Modeling Algorithms - BRepOffset_Tool Segmentation Fault Added protection against null pointer dereferencing. Modified BRepOffset_MakeOffset::MakeThickSolid method. |
|
Branch CR31601 has been updated by astromko. SHA-1: 7ef7d252f81dd529987aaef2f9cb532e70592651 Detailed log of new commits: Author: astromko Date: Mon Feb 12 21:50:46 2024 +0000 0031601: Modeling Algorithms - BRepOffset_Tool Segmentation Fault Fixed the problem with negative volume values |
|
Branch CR31601 has been updated forcibly by astromko. SHA-1: 171ea61394a04c97904ad0b79db566c746853606 |
|
Branch CR31601 has been updated by astromko. SHA-1: 3fca09976525451808fd5b4651dc0d4f78ec218b Detailed log of new commits: Author: astromko Date: Wed Feb 14 21:48:42 2024 +0000 0031601: Modeling Algorithms - BRepOffset_Tool Segmentation Fault Fixed 2 unit tests: "offset compshape A1" and "offset shape A1". |
|
Jenkins: http://jenkins-test-10.nnov.opencascade.com/view/CR31601-master-astromko/ Regarding the changes. In case of "if (NbOF <= NbF)" the "offsetperform" command is never executed in my tests with the message "ERROR. offsetperform operation not done.". Changed to "if (NbOF < NbF)". And in case of "if (NbOF == NbF)" set myOffset to 0 to avoid reversing to negative volume value. |
|
The patch seems good, but test cases "offset faces_type_i" still remain, but now, these cases are OK (but it is not, because the resulted shapes the same as original: you can compare vprops of result and initial shape). My suggestion is to add checking return value of method BRepOffset_Tool::TryProject(). Small remark - please, use 2 spaces instead of 4 in BRepOffset_Tool.cxx: 1884+ if (C.IsNull()) 1885+ return Standard_False; Please, add test case for this bug. |
|
Branch CR31601 has been updated forcibly by astromko. SHA-1: 2844f1c1beeac17bffe01d3e557060cb529c8dc9 |
|
Added checking return value of method BRepOffset_Tool::TryProject(). Added a test case. There are 18 failed tests that came from master after rebase. 17 from them have the error "ERROR: Process killed by elapsed limit". And 1 test is about exception. |
|
Please, delete new bool variables "retVal" from BRepOffset_Tool.cxx and BRepOffset_Inter3d.cxx, and add whole method BRepOffset_Tool::TryProject() into "if" instead. BRepOffset_MakeOffset.cxx: 1184+ if (NbOF == NbF) 1185+ myOffset = 0; add brackets. And run tests on Jecnkins again. |
|
Branch CR31601 has been updated forcibly by astromko. SHA-1: 7a61d41be674f18b6d3f728cd7e5bb53b36f56b0 |
|
All remarks are fixed. |
|
Branch CR31601 has been updated forcibly by astromko. SHA-1: 4ff3213b70bba746fa8e7353461348d9e9ca35bc |
|
Added an image into "bugs modalg_8 bug31601" test. @akaftasev please take a look. Jenkins: http://jenkins-test-10.nnov.opencascade.com/view/CR31601-master-astromko/ |
|
Test bugs modalg_7 bug25395_1 test still IMPROVEMENT for some reason heal checkshape bug27814_3 failed |
|
Branch CR31601 has been updated forcibly by astromko. SHA-1: ef69d14e056a8d5ee80386180fdaf4873263cdca |
|
The problems are fixed. |
|
Please, Integrate branch: OCCT - CR31601 Products - None |
|
Combination - OCCT branch : IR-2024-03-22 master SHA - 983e35ed71b95137772111751ad41a5da4937005 d2ef868da4165400c82322bd7f11b652decce47a Products branch : master SHA - 4019cd9a039aa9bb8252b865410207f8d4cf3eb4 was compiled on Linux, MacOS and Windows platforms and tested in optimize mode. Number of compiler warnings: No new/fixed warnings Regressions/Differences/Improvements: No regressions/differences CPU differences: Ubuntu2004-64: OCCT Total CPU difference: 18418.419999999944 / 18393.07999999986 [+0.14%] Products Total CPU difference: 11606.279999999959 / 11191.209999999957 [+3.71%] Windows-64-VC142: OCCT Total CPU difference: 20726.4375 / 20708.5625 [+0.09%] Products Total CPU difference: 12849.890625 / 12614.34375 [+1.87%] Image differences : No differences that require special attention Memory differences : No differences that require special attention |
|
Branch CR31601 has been deleted by vglukhik. SHA-1: ef69d14e056a8d5ee80386180fdaf4873263cdca |
occt: master 576f3761 2024-02-08 17:02:45 Committer: vglukhik Details Diff |
0031601: Modeling Algorithms - BRepOffset_Tool Segmentation Fault Added protection against null pointer dereferencing. Modified BRepOffset_MakeOffset::MakeThickSolid method. Fixed the problem with negative volume values. Fixed several unit tests and added a new one. |
Affected Issues 0031601 |
|
mod - src/BRepOffset/BRepOffset_Inter3d.cxx | Diff File | ||
mod - src/BRepOffset/BRepOffset_MakeOffset.cxx | Diff File | ||
mod - src/BRepOffset/BRepOffset_Tool.cxx | Diff File | ||
mod - tests/bugs/modalg_2/bug427_6 | Diff File | ||
mod - tests/bugs/modalg_2/bug5805_18 | Diff File | ||
mod - tests/bugs/modalg_2/bug5805_19 | Diff File | ||
mod - tests/bugs/modalg_2/bug5805_20 | Diff File | ||
mod - tests/bugs/modalg_2/bug5805_42 | Diff File | ||
mod - tests/bugs/modalg_2/bug5805_43 | Diff File | ||
mod - tests/bugs/modalg_2/bug5805_44 | Diff File | ||
mod - tests/bugs/modalg_7/bug25395_1 | Diff File | ||
mod - tests/bugs/modalg_7/bug25939 | Diff File | ||
mod - tests/bugs/modalg_7/bug31845_f | Diff File | ||
mod - tests/bugs/modalg_7/bug31845_i | Diff File | ||
add - tests/bugs/modalg_8/bug31601 | Diff File | ||
mod - tests/offset/compshape/A1 | Diff File | ||
mod - tests/offset/compshape/A4 | Diff File | ||
mod - tests/offset/faces_type_i/A9 | Diff File | ||
mod - tests/offset/faces_type_i/B4 | Diff File | ||
mod - tests/offset/faces_type_i/B5 | Diff File | ||
mod - tests/offset/faces_type_i/B6 | Diff File | ||
mod - tests/offset/faces_type_i/C1 | Diff File | ||
mod - tests/offset/faces_type_i/C2 | Diff File | ||
mod - tests/offset/faces_type_i/C5 | Diff File | ||
mod - tests/offset/faces_type_i/C9 | Diff File | ||
mod - tests/offset/faces_type_i/D1 | Diff File | ||
mod - tests/offset/faces_type_i/E7 | Diff File | ||
mod - tests/offset/faces_type_i/E8 | Diff File | ||
mod - tests/offset/faces_type_i/E9 | Diff File | ||
mod - tests/offset/faces_type_i/F1 | Diff File | ||
mod - tests/offset/faces_type_i/F2 | Diff File | ||
mod - tests/offset/faces_type_i/F3 | Diff File | ||
mod - tests/offset/faces_type_i/F4 | Diff File | ||
mod - tests/offset/faces_type_i/F5 | Diff File | ||
mod - tests/offset/faces_type_i/I5 | Diff File | ||
mod - tests/offset/faces_type_i/J5 | Diff File | ||
mod - tests/offset/faces_type_i/K6 | Diff File | ||
mod - tests/offset/faces_type_i/M6 | Diff File | ||
mod - tests/offset/faces_type_i/M8 | Diff File | ||
mod - tests/offset/faces_type_i/N1 | Diff File | ||
mod - tests/offset/shape/A1 | Diff File |
Date Modified | Username | Field | Change |
---|---|---|---|
2020-06-07 17:50 | abdullah | New Issue | |
2020-06-07 17:50 | abdullah | Assigned To | => msv |
2022-02-14 11:19 |
|
Note Added: 0106886 | |
2022-06-24 15:48 |
|
Assigned To | msv => vmigunov |
2022-06-24 15:48 |
|
Target Version | => 7.7.0 |
2022-06-24 15:48 |
|
Steps to Reproduce Updated | |
2022-06-24 15:48 |
|
Status | new => assigned |
2022-07-05 08:57 |
|
Status | assigned => resolved |
2022-07-05 08:58 |
|
Assigned To | vmigunov => azv |
2022-07-05 09:02 |
|
Assigned To | azv => vmigunov |
2022-07-05 09:02 |
|
Status | resolved => assigned |
2022-10-24 10:40 |
|
Target Version | 7.7.0 => 7.8.0 |
2023-08-01 15:08 | dpasukhi | Target Version | 7.8.0 => Unscheduled |
2024-01-30 12:27 | dpasukhi | Note Added: 0115006 | |
2024-01-30 12:32 | dpasukhi | Assigned To | vmigunov => astromko |
2024-02-07 15:32 | dpasukhi | Summary | BRepOffset_Tool - Segmentation Fault => Modeling Algorithms - BRepOffset_Tool Segmentation Fault |
2024-02-08 20:03 | git | Note Added: 0115057 | |
2024-02-13 00:50 | git | Note Added: 0115073 | |
2024-02-14 22:08 | git | Note Added: 0115089 | |
2024-02-15 00:48 | git | Note Added: 0115091 | |
2024-02-15 13:29 | astromko | Assigned To | astromko => oan |
2024-02-15 13:29 | astromko | Status | assigned => resolved |
2024-02-15 13:29 | astromko | Note Added: 0115094 | |
2024-02-16 19:20 | astromko | Assigned To | oan => akaftasev |
2024-02-19 14:10 | akaftasev | Assigned To | akaftasev => astromko |
2024-02-19 14:10 | akaftasev | Status | resolved => assigned |
2024-02-19 14:10 | akaftasev | Note Added: 0115136 | |
2024-02-19 14:11 | akaftasev | Note Edited: 0115136 | |
2024-02-19 14:13 | akaftasev | Note Edited: 0115136 | |
2024-02-22 16:52 | git | Note Added: 0115152 | |
2024-02-23 18:06 | astromko | Assigned To | astromko => akaftasev |
2024-02-23 18:06 | astromko | Status | assigned => resolved |
2024-02-23 18:06 | astromko | Note Added: 0115162 | |
2024-02-29 14:25 | akaftasev | Assigned To | akaftasev => astromko |
2024-02-29 14:25 | akaftasev | Status | resolved => assigned |
2024-02-29 14:25 | akaftasev | Note Added: 0115198 | |
2024-02-29 15:56 | git | Note Added: 0115200 | |
2024-02-29 17:00 | astromko | Assigned To | astromko => akaftasev |
2024-02-29 17:00 | astromko | Status | assigned => resolved |
2024-02-29 17:00 | astromko | Note Added: 0115202 | |
2024-03-01 15:06 | git | Note Added: 0115209 | |
2024-03-12 23:19 | astromko | Note Added: 0115341 | |
2024-03-13 11:06 | dpasukhi | Note Added: 0115342 | |
2024-03-13 11:58 | git | Note Added: 0115343 | |
2024-03-13 13:48 | astromko | Note Added: 0115346 | |
2024-03-18 13:37 | akaftasev | Assigned To | akaftasev => bugmaster |
2024-03-18 13:37 | akaftasev | Status | resolved => reviewed |
2024-03-18 13:37 | akaftasev | Note Added: 0115403 | |
2024-03-18 16:53 | dpasukhi | Description Updated | |
2024-03-25 04:57 | vglukhik | Changeset attached | => occt master 576f3761 |
2024-03-25 04:57 | astromko | Assigned To | bugmaster => astromko |
2024-03-25 04:57 | astromko | Status | reviewed => verified |
2024-03-25 04:57 | astromko | Resolution | open => fixed |
2024-03-25 20:24 | vglukhik | Note Added: 0115461 | |
2024-04-08 19:28 | git | Note Added: 0115651 |