DiscussionsIssue archiveOCCT:Data Exchange

Archived issue #0029478

Crash because bSplineSurfaceWithKnots is NULL

CommunityOCCT:Data Exchangeclosed8 public notes

Search issues

Description

I created a simplified STP file(see attachment) using WorkXplore 2018.1.0 x64.

The crash happens here:

BS = BSR->BSplineSurfaceWithKnots(); // returns NULL
...
const Standard_Integer UDeg = BS->UDegree(); // crashes here


Here is the full code:


Handle(Geom_BSplineSurface) StepToGeom::MakeBSplineSurface (const Handle(StepGeom_BSplineSurface)& SS)
{
  Standard_Integer i, j;
  Handle(StepGeom_BSplineSurfaceWithKnots) BS;
  Handle(StepGeom_BSplineSurfaceWithKnotsAndRationalBSplineSurface) BSR;

  if (SS->
      IsKind(STANDARD_TYPE(StepGeom_BSplineSurfaceWithKnotsAndRationalBSplineSurface))) {
    BSR =
      Handle(StepGeom_BSplineSurfaceWithKnotsAndRationalBSplineSurface)
    ::DownCast(SS);
    BS = BSR->BSplineSurfaceWithKnots();
  }
  else
    BS = Handle(StepGeom_BSplineSurfaceWithKnots)::DownCast(SS);

  const Standard_Integer UDeg = BS->UDegree();
...

Steps to reproduce

This is how I'm using the Step Reader. The software crashes in TransferRoots() everytime.


// Remove std::cout from the printer list of OpenCASCADE
// More precisely, remove ALL printers from the list.
Message::DefaultMessenger()->ChangePrinters().Clear();

// Install our own error printer
std::string error_message;
Message::DefaultMessenger()->AddPrinter(Handle_Message_Printer(new STEPErrorPrinter(&error_message, STEPErrorLevel::FAILURE)));

auto reader = STEPControl_Reader();
reader.ReadFile(d_filename.c_str());
reader.TransferRoots();

Public activity

8 archived notes

Participants are labeled by their role within this record.

01Commenter 1
Branch [archived branch] has been created by Commenter 2.

[revision removed]


Detailed log of new commits:

Author: asemenov
Date: Fri Sep 17 18:46:43 2021 +0300

    0029478: Crash because bSplineSurfaceWithKnots is NULL.
    
    Modified the method void RWStepGeom_RWBSplineSurfaceWithKnotsAndRationalBSplineSurface::ReadStep
    Added processing B spline surface with knots and rational B spline surface with empty data in the name field
    Added test
02Commenter 1
Branch [archived branch] has been updated forcibly by Commenter 3.

[revision removed]
03Commenter 2
When reading the empty namе field of the B_Spline_Surface_With_Knots entity with Rational_B_Spline_Surface from the STEP file, then an empty entity with no data is created.
04Commenter 2
Dear ika, please review branch CR29478
05Commenter 3
No remarks.
Tests are OK http://jenkins-test-occt/view/CR29478-master-Commenter 2/

Dear bugmaster,

please integrate:
OCCT - CR29478
Products - NOT
06Commenter 4
Artem, please print bug description using "puts" instead of a Tcl-comment in future patches, so that it will be available in HTML log.

+# Crash because bSplineSurfaceWithKnots is NULL
07Commenter 7
Combination -
OCCT branch : [archived branch]
master SHA - [revision removed]
[revision removed]
Products branch : [archived branch] SHA - [revision removed]
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:
Debian80-64:
OCCT
Total CPU difference: 17446.850000000457 / 17398.820000000545 [+0.28%]
Products
---
Windows-64-VC14:
OCCT
Total CPU difference: 19308.25 / 19330.984375 [-0.12%]
Products
---


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention
08Commenter 1
Branch [archived branch] has been deleted by Participant.

[revision removed]