DiscussionsIssue archiveOCCT:Modeling Algorithms

Archived issue #0031041

Modeling Algorithms - Crash in BRepOffsetAPI_MakePipeShell

CommunityOCCT:Modeling Algorithmsclosed17 public notes

Search issues

Description

The following code causes access to null shape and as a result - crash. I think it was caused by 0029204: BRepOffsetAPI_MakePipeShell produces invalid result and raises exception in Draw

double tol = 6.[revision removed]-07;

sweep.SetTransitionMode(BRepBuilderAPI_TransitionMode::BRepBuilderAPI_RightCorner);
sweep.Add(profile, location, Standard_False, Standard_False);
sweep.SetTolerance(tol, tol);
sweep.Build();


The fix is to add in BRepFill_TrimShellCorner::ChooseSection check if firstedge and lastedge is null.

Steps to reproduce

restore Attachment 1 (BREP) loc
restore Attachment 2 (BREP) pr
restore Attachment 2 (BREP) sp
mksweep sp
addsweep pr loc
buildsweep r -C

Public activity

17 archived notes

Participants are labeled by their role within this record.

01Commenter 1
It seems the test case is incomplete. What are the parameters passed to the constructor of the algorithm? Where is the spine contour?

I would expect to reproduce the bug using the following draw script:

mksweep sp
addsweep pr loc
buildsweep r -C

The shape sp is missing in your input data.

02Author
Sorry, forgot about it. I`ve uploaded the missing file

Here is the full code
BRepOffsetAPI_MakePipeShell sweep(spine);
sweep.SetTransitionMode(BRepBuilderAPI_TransitionMode::BRepBuilderAPI_RightCorner);
sweep.Add(profile, location, Standard_False, Standard_False);
sweep.SetTolerance(tol, tol);
sweep.Build();
03Author
Reminder sent to: msv

04Commenter 4
I'll look at it soon. Just too much urgent work currently.
05Commenter 5
I have added in steps to reproduce the draw script corresponding to the code snippet.
06Commenter 6
Now it gives access violation exception.
07Author
Correct, I have the same behavior. The reason is described in my first post. In some cases the method in BRepFill_TrimShellCorner returns null shape and we do not check if it is null. (We do it only in one of 3 places where the method is used).
08Commenter 2
Branch [archived branch] has been created by Commenter 3.

[revision removed]


Detailed log of new commits:

Author: Commenter 3
Date: Wed Jun 19 17:21:41 2024 +0100

    0031041: Modeling Algorithms - Crash in BRepOffsetAPI_MakePipeShell
    
    Removed unnecessary vertex initialization that caused the problem,
09Commenter 1
Looks like it is not unnecessary. It can be used below.
10Commenter 2
Branch [archived branch] has been updated forcibly by Commenter 3.

[revision removed]
11Commenter 2
Branch [archived branch] has been updated forcibly by Commenter 3.

[revision removed]
12Commenter 3
Fixed. The initialization moved to another place.
13Commenter 1
TheV is always null.
The exception still will be in case if Vertex is null.
And there are still some possible crashes in case of empty vertex
Need to redesign solution.
   if(TheV.IsNull())
+  {
     Place.Perform(Precision::Confusion());
-  else {
-    Place.Perform(SearchParam(myLaw, Ind1, TheV), 
-                 Precision::Confusion());    
+    TheV = TopoDS::Vertex(Vertex);
+  }
14Commenter 2
Branch [archived branch] has been updated forcibly by Commenter 3.

[revision removed]
15Commenter 1
I'm sorry, when I say is always null. I was meaning, if when it going to null in function, it never updated.
In most cases it is not null
16Commenter 3
I reorganized the code.
17Commenter 1

Related records