MantisBT
Mantis Bug Tracker Workflow

View Issue Details Jump to Notes ] Related Changesets ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0027070Community[OCCT] OCCT:Data Exchangepublic2016-01-10 20:422018-06-29 21:21
ReporterEpy 
Assigned Tobugmaster 
PrioritynormalSeveritycrash 
StatusclosedResolutionfixed 
Platformx86-64OSLubuntuOS Version15.10 x64
Product Version[OCCT] 6.8.0 
Target Version[OCCT] 7.3.0Fixed in Version[OCCT] 7.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 Filescxx file icon Ex7_HLRDump.cxx (1,326 bytes) 2016-01-10 20:42
? file icon Ex1_ExtrudeAndCut.stp (22,551 bytes) 2016-01-10 20:42

- Relationships

-  Notes
(0049764)
msv (developer)
2016-01-11 00:43

The sample program is incorrect, as it does not check the shapes for null before passing them for transferring.
(0049765)
Epy (developer)
2016-01-11 01:02

Very well, but it seems strange that STEPControl_Writer::Transfer() does not check to see if the input shape is null first.
(0049766)
msv (developer)
2016-01-11 10:03

Dear gka, what is your opinion? Do we need to implement protection against null shapes in Transfer method?
(0074365)
git (administrator)
2018-03-08 09:56

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)
(0074366)
abv (manager)
2018-03-08 09:58

Fix (protection against null shape) is pushed to CR27070, please review
(0074460)
abv (manager)
2018-03-14 10:19

The tests passed OK indeed, see Jenkins job CR27070-master-abv
(0074480)
bugmaster (administrator)
2018-03-14 16:23

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
(0074591)
git (administrator)
2018-03-19 10:05

Branch CR27070 has been deleted by kgv.

SHA-1: 9fe3015bc4741de506eb9ecb52696c0091f34ff4

- Related Changesets
occt: master 0a0eec80
Timestamp: 2018-03-08 06:56:01
Author: 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)
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 View Revisions
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 user533 Fixed in Version => 7.3.0
2018-06-29 21:21 user533 Status verified => closed


Copyright © 2000 - 2018 MantisBT Team
Powered by Mantis Bugtracker