View Issue Details

IDProjectCategoryView StatusLast Update
0027070CommunityOCCT:Data Exchangepublic2018-06-29 21:21
ReporterEpy Assigned Tobugmaster  
PrioritynormalSeveritycrash 
Status closedResolutionfixed 
Platformx86-64OSLubuntu 
Product Version6.8.0 
Target Version7.3.0Fixed in Version7.3.0 
Summary0027070: Data Exchange - Segfault when transferring HLR-created shapes via STEPControl_Writer
DescriptionI created the following small program to explore the outlines and hidden lines created by HLR. The program segfaults on all of the commented lines. I used the program with another STEP file which was also created by OCCT libraries.



#include <STEPControl_Reader.hxx>
#include <TopoDS_Shape.hxx>
#include <HLRBRep_Algo.hxx>
#include <gp_Ax2.hxx>
#include <gp_Dir.hxx>
#include <HLRAlgo_Projector.hxx>
#include <HLRBRep_HLRToShape.hxx>
#include <STEPControl_Writer.hxx>

int main(int argc, char **argv)
{
    if (argc < 2)
        return 1;

    STEPControl_Reader scr;
    scr.ReadFile(argv[1]);
    scr.TransferRoots();

    Handle(HLRBRep_Algo) hlr = new HLRBRep_Algo;
    hlr->Add(scr.OneShape());

    gp_Ax2 a1(gp::Origin(), gp_Dir(0, 1, 0));
    HLRAlgo_Projector proj(a1);
    hlr->Projector(proj);
    hlr->Update();
    hlr->Hide();
    HLRBRep_HLRToShape shapes(hlr);

    STEPControl_Writer scw;
    scw.Transfer(shapes.VCompound(), STEPControl_AsIs);
    // scw.Transfer(shapes.Rg1LineVCompound(), STEPControl_AsIs);
    // scw.Transfer(shapes.RgNLineVCompound(), STEPControl_AsIs);
    // scw.Transfer(shapes.OutLineVCompound(), STEPControl_AsIs);
    // scw.Transfer(shapes.IsoLineVCompound(), STEPControl_AsIs);
    scw.Transfer(shapes.HCompound(), STEPControl_AsIs);
    // scw.Transfer(shapes.Rg1LineHCompound(), STEPControl_AsIs);
    // scw.Transfer(shapes.RgNLineHCompound(), STEPControl_AsIs);
    // scw.Transfer(shapes.OutLineHCompound(), STEPControl_AsIs);
    // scw.Transfer(shapes.IsoLineHCompound(), STEPControl_AsIs);
    scw.Write("Ex7_HLRDump.stp");

    return 0;
}
Steps To Reproducepload XSDRAW
dall
stepwrite a a
TagsNo tags attached.
Test case numberbugs step bug27070

Attached Files

  • Ex7_HLRDump.cxx (1,326 bytes)
  • Ex1_ExtrudeAndCut.stp (22,551 bytes)

Activities

Epy

2016-01-10 20:42

developer  

Ex7_HLRDump.cxx (1,326 bytes)

Epy

2016-01-10 20:42

developer  

Ex1_ExtrudeAndCut.stp (22,551 bytes)

msv

2016-01-11 00:43

developer   ~0049764

The sample program is incorrect, as it does not check the shapes for null before passing them for transferring.

Epy

2016-01-11 01:02

developer   ~0049765

Very well, but it seems strange that STEPControl_Writer::Transfer() does not check to see if the input shape is null first.

msv

2016-01-11 10:03

developer   ~0049766

Dear gka, what is your opinion? Do we need to implement protection against null shapes in Transfer method?

git

2018-03-08 09:56

administrator   ~0074365

Branch CR27070 has been created by abv.

SHA-1: 9fe3015bc4741de506eb9ecb52696c0091f34ff4


Detailed log of new commits:

Author: abv
Date: Thu Mar 8 09:56:01 2018 +0300

    0027070: Segfault when transferring HLR-created shapes via STEPControl_Writer
    
    Added protection against null shape on writing: status IFSelect_RetVoid will be returned in such case (instead of access violation)

abv

2018-03-08 09:58

manager   ~0074366

Fix (protection against null shape) is pushed to CR27070, please review

abv

2018-03-14 10:19

manager   ~0074460

The tests passed OK indeed, see Jenkins job CR27070-master-abv

bugmaster

2018-03-14 16:23

administrator   ~0074480

Combination -
OCCT branch : CR27070 SHA - 9fe3015bc4741de506eb9ecb52696c0091f34ff4
Products branch : master SHA - 4fd289ec73d35d02f23f3990c73b3acac9a60574
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:
Debian70-64:
OCCT
Total CPU difference: 18226.24999999965 / 18338.37999999957 [-0.61%]
Products
Total CPU difference: 7463.559999999991 / 7461.340000000009 [+0.03%]
Windows-64-VC10:
OCCT
Total CPU difference: 17843.83118279852 / 17653.338361698563 [+1.08%]
Products
Total CPU difference: 8007.858932099991 / 7990.761222500007 [+0.21%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention

git

2018-03-19 10:05

administrator   ~0074591

Branch CR27070 has been deleted by kgv.

SHA-1: 9fe3015bc4741de506eb9ecb52696c0091f34ff4

Related Changesets

occt: master 0a0eec80

2018-03-08 06:56:01

abv


Committer: bugmaster Details Diff
0027070: Segfault when transferring HLR-created shapes via STEPControl_Writer

Added protection against null shape on writing: status IFSelect_RetVoid will be returned in such case (instead of access violation)
Affected Issues
0027070
mod - src/XSControl/XSControl_WorkSession.cxx Diff File
add - tests/bugs/step/bug27070 Diff File

Issue History

Date Modified Username Field Change
2016-01-10 20:42 Epy New Issue
2016-01-10 20:42 Epy Assigned To => msv
2016-01-10 20:42 Epy File Added: Ex7_HLRDump.cxx
2016-01-10 20:42 Epy File Added: Ex1_ExtrudeAndCut.stp
2016-01-11 00:43 msv Note Added: 0049764
2016-01-11 00:43 msv Assigned To msv => Epy
2016-01-11 00:43 msv Status new => feedback
2016-01-11 00:43 msv Resolution open => no change required
2016-01-11 01:02 Epy Note Added: 0049765
2016-01-11 10:03 msv Note Added: 0049766
2016-01-11 10:03 msv Assigned To Epy => gka
2016-01-11 10:04 msv Category OCCT:Modeling Algorithms => OCCT:Data Exchange
2017-08-14 16:16 abv Target Version => 7.3.0
2018-03-08 09:56 git Note Added: 0074365
2018-03-08 09:58 abv Note Added: 0074366
2018-03-08 09:58 abv Status feedback => resolved
2018-03-08 09:58 abv Steps to Reproduce Updated
2018-03-08 13:58 kgv Summary Segfault when transferring HLR-created shapes via STEPControl_Writer => Data Exchange - Segfault when transferring HLR-created shapes via STEPControl_Writer
2018-03-09 12:13 abv Resolution no change required => fixed
2018-03-14 10:19 abv Note Added: 0074460
2018-03-14 15:07 gka Assigned To gka => bugmaster
2018-03-14 15:07 gka Status resolved => reviewed
2018-03-14 16:19 bugmaster Test case number => bugs step bug27070
2018-03-14 16:23 bugmaster Note Added: 0074480
2018-03-14 16:23 bugmaster Status reviewed => tested
2018-03-18 13:21 bugmaster Changeset attached => occt master 0a0eec80
2018-03-18 13:21 bugmaster Status tested => verified
2018-03-19 10:05 git Note Added: 0074591
2018-06-29 21:16 aiv Fixed in Version => 7.3.0
2018-06-29 21:21 aiv Status verified => closed