View Issue Details

IDProjectCategoryView StatusLast Update
0033090CommunityOCCT:Modeling Algorithmspublic2022-08-05 21:22
Reporterchristoph.jung_153651 Assigned Toakondrat 
PrioritynormalSeveritycrash 
Status assignedResolutionopen 
PlatformWindowsOSVC++ 2015 
Product Version7.4.0 
Summary0033090: Access violation using fuzzy boolean operations
DescriptionWhile debugging the code in the field reproduction, an access violation was reported by MS VS. The attached file contains the necessary data.
Occurs in OCCT 7.4.0. Respective Code is unchanged in OCCT 7.6.0:

happens if myUparams.IsNull() in

void IntTools_SurfaceRangeLocalizeData::SetFrame(const Standard_Real theUMin,
                         const Standard_Real theUMax,
                         const Standard_Real theVMin,
                         const Standard_Real theVMax)
{
  myUIndMin = 0;
  myUIndMax = 0;
  myVIndMin = 0;
  myVIndMax = 0;

  if (myUParams.IsNull() || myVParams.IsNull()) {
    return;
  }

The routine is used in

IntTools\IntTools_BeanFaceIntersector.cxx

void BuildBox(const Handle(Geom_BSplineSurface) &theSurf,
      const Standard_Real theFirstU,
      const Standard_Real theLastU,
      const Standard_Real theFirstV,
      const Standard_Real theLastV,
            IntTools_SurfaceRangeLocalizeData &theSurfaceData,
              Bnd_Box &theBox)
{
  Standard_Integer i;
  Standard_Integer j;
  Standard_Integer aNbUPnts;
  Standard_Integer aNbVPnts;
  Standard_Real aParam;
  gp_Pnt aPnt;

  theSurfaceData.SetFrame(theFirstU, theLastU, theFirstV, theLastV);
  aNbUPnts = theSurfaceData.GetNBUPointsInFrame();
  aNbVPnts = theSurfaceData.GetNBVPointsInFrame();

  // Add corner points.
  theSurf->D0(theFirstU, theFirstV, aPnt);
  theBox.Add(aPnt);
  theSurf->D0(theLastU, theFirstV, aPnt);
  theBox.Add(aPnt);
  theSurf->D0(theFirstU, theLastV, aPnt);
  theBox.Add(aPnt);
  theSurf->D0(theLastU, theLastV, aPnt);
  theBox.Add(aPnt);

  for (i = 1; i <= aNbUPnts; i++) {
    // Add top and bottom points.
    aParam = theSurfaceData.GetUParamInFrame(i);

and the access violation occurs then in GetUParamInFrame(i), because e.g. aNbUPnts = 1, because:

inline Standard_Integer IntTools_SurfaceRangeLocalizeData::
                                 GetNBUPointsInFrame() const
{
  return myUIndMax - myUIndMin + 1;
}

0-0+1 = 1
Steps To ReproduceThis would be a model to reproduce the bug:

TopoDS_Shape s;
BRep_Builder b;
std::ifstream is;
is.open("D://EF.brep");
BRepTools::Read(s, is, b);
is.close();
TopExp_Explorer exp(s, TopAbs_FACE);
TopExp_Explorer expe(s, TopAbs_EDGE);
IntTools_EdgeFace* in = new IntTools_EdgeFace();
in->SetEdge(TopoDS::Edge(expe.Current()));
in->SetFuzzyValue(0.1);
in->SetFace(TopoDS::Face(exp.Current()));
in->UseQuickCoincidenceCheck(false);
in->SetRange(5.1673518776073308, 6.7381478044021721);
in->Perform();
Additional information
and documentation updates
The problem does not occur if using the following code:

src/IntTools/IntTools_SurfaceRangeLocalizeData.lxx
+ 2
- 2
Viewed
@@ -115,13 +115,13 @@ inline const gp_Pnt &IntTools_SurfaceRangeLocalizeData::GetGridPoint
inline Standard_Integer IntTools_SurfaceRangeLocalizeData::
                                 GetNBUPointsInFrame() const
{
- return myUIndMax - myUIndMin + 1;
+ return myUParams.IsNull()? 0 : myUIndMax - myUIndMin + 1;
}


inline Standard_Integer IntTools_SurfaceRangeLocalizeData::
                                 GetNBVPointsInFrame() const
{
- return myVIndMax - myVIndMin + 1;
+ return myVParams.IsNull()? 0 : myVIndMax - myVIndMin + 1;
}


TagsNo tags attached.
Test case number

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2022-08-05 17:00 christoph.jung_153651 New Issue
2022-08-05 17:00 christoph.jung_153651 Assigned To => msv
2022-08-05 21:22 msv Assigned To msv => akondrat
2022-08-05 21:22 msv Status new => assigned