View Issue Details

IDProjectCategoryView StatusLast Update
0033508CommunityOCCT:Modeling Algorithmspublic2024-05-16 14:29
ReporterAaron Michalk Assigned To 
PrioritynormalSeveritycrash 
Status newResolutionopen 
PlatformMacOSOS 
Product Version7.7.1 
Summary0033508: Dangling pointer in LocOpe_Spliter.cxx in 7.7.2
DescriptionWe were hitting an intermittent bad memory access on Mac ARM in LocOpe_Spliter.cxx. I spent some time trying to get source code in the debugger in XCode, but wasn't able to figure that out. I tried reverting the change below and the problem went away. This reproduced with splitting a planar face with four edges with a perpendicular plane that intersects it in the middle. I'm sorry I don't have steps to reproduce as our code is proprietary. Changing code from pinning a value to a reference can have some small performance improvements but carries some risk. I noticed there were some similar changes in other files.

diff --git a/src/LocOpe/LocOpe_Spliter.cxx b/src/LocOpe/LocOpe_Spliter.cxx
index 5dbadd8..5f282dd 100644 (file)
--- a/src/LocOpe/LocOpe_Spliter.cxx
+++ b/src/LocOpe/LocOpe_Spliter.cxx
@@ -471,7 +471,7 @@ void LocOpe_Spliter::Perform(const Handle(LocOpe_WiresOnShape)& PW)
       }
     }
     if (itms.More()) {
- TopoDS_Shape fac = itms.Key();
+ const TopoDS_Shape& fac = itms.Key();
       for (exp.Init(fac,TopAbs_EDGE); exp.More(); exp.Next()) {
        if (!Mapebord.Add(exp.Current())) {
          Mapebord.Remove(exp.Current());

Steps To ReproduceCall stack
> TKFeat.dll!LocOpe_Spliter::Perform(const opencascade::handle<LocOpe_WiresOnShape> & PW) Line 460 C++
     TKFeat.dll!BRepFeat_SplitShape::Build(const Message_ProgressRange & __formal) Line 30 C++
     CAModel.dll!EditShape::breakEdge(ShapeSelection & selection, const gp_Pnt & point) Line 1034 C++

shape::ShapeMap EditShape::breakEdge(ShapeSelection & selection, const gp_Pnt & point) {
    ...
    gp_Pln planePerpendicularToEdge(onedge, normal);
    BRepAlgoAPI_Section section(adjacent, planePerpendicularToEdge, false);
    section.ComputePCurveOn1(true);
    section.Build();
    TopoDS_Shape edges = section;
    BRepFeat_SplitShape splitter(selection.shape);
    for (auto & newedge : ShapeIterator<TopoDS_Edge>(edges)) {
        //debugDrawEdge(adjacent, newedge);
        splitter.Add(newedge, adjacent);
    }
    splitter.Build();
    ...
}


TagsNo tags attached.
Test case number

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2023-10-19 19:43 Aaron Michalk New Issue
2023-10-19 19:43 Aaron Michalk Assigned To => oan
2024-05-16 14:29 oan Assigned To oan =>