MantisBT
Mantis Bug Tracker Workflow

View Issue Details Jump to Notes ] Related Changesets ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0030562Community[OCCT] OCCT:Codingpublic2019-03-12 19:352019-03-19 10:33
Reportergalbramc 
Assigned Toapn 
PrioritynormalSeveritycrash 
StatusverifiedResolutionfixed 
PlatformOSOS Version
Product Version[OCCT] 5.2.2 
Target Version[OCCT] 7.4.0*Fixed in Version 
Summary0030562: Coding - TopOpeBRepBuild_Builder use of null pointer
DescriptionI got the following error running with OCCT 7.3.0 compiled with -fsanitize=undefined:

src/TopOpeBRepBuild/TopOpeBRepBuild_Builder.cxx:197:63: runtime error: member call on null pointer of type 'struct TopOpeBRepDS_HDataStructure'
src/TopOpeBRepBuild/TopOpeBRepBuild_Builder.cxx:197:63: runtime error: member access within null pointer of type 'struct TopOpeBRepDS_HDataStructure'

I found that the following patch resolves the issue:


Index: src/TopOpeBRepBuild/TopOpeBRepBuild_Builder.cxx
===================================================================
--- src/TopOpeBRepBuild/TopOpeBRepBuild_Builder.cxx (revision 1)
+++ src/TopOpeBRepBuild/TopOpeBRepBuild_Builder.cxx (working copy)
@@ -194,27 +194,30 @@
 //=======================================================================
 void TopOpeBRepBuild_Builder::Clear()
 {
- const TopOpeBRepDS_DataStructure& BDS = myDataStructure->DS();
- TopOpeBRepDS_DataMapIteratorOfDataMapOfShapeListOfShapeOn1State it;
- for (it.Initialize(mySplitOUT); it.More(); it.Next()) {
- const TopoDS_Shape& e = it.Key();
- if ( e.ShapeType() == TopAbs_EDGE ) {
- Standard_Boolean isse = BDS.IsSectionEdge(TopoDS::Edge(e));
- if (!isse) mySplitOUT.ChangeFind(e).Clear();
+ if (!myDataStructure.IsNull())
+ {
+ const TopOpeBRepDS_DataStructure& BDS = myDataStructure->DS();
+ TopOpeBRepDS_DataMapIteratorOfDataMapOfShapeListOfShapeOn1State it;
+ for (it.Initialize(mySplitOUT); it.More(); it.Next()) {
+ const TopoDS_Shape& e = it.Key();
+ if ( e.ShapeType() == TopAbs_EDGE ) {
+ Standard_Boolean isse = BDS.IsSectionEdge(TopoDS::Edge(e));
+ if (!isse) mySplitOUT.ChangeFind(e).Clear();
+ }
     }
- }
- for (it.Initialize(mySplitIN); it.More(); it.Next()) {
- const TopoDS_Shape& e = it.Key();
- if ( e.ShapeType() == TopAbs_EDGE ) {
- Standard_Boolean isse = BDS.IsSectionEdge(TopoDS::Edge(e));
- if (!isse) mySplitIN.ChangeFind(e).Clear();
+ for (it.Initialize(mySplitIN); it.More(); it.Next()) {
+ const TopoDS_Shape& e = it.Key();
+ if ( e.ShapeType() == TopAbs_EDGE ) {
+ Standard_Boolean isse = BDS.IsSectionEdge(TopoDS::Edge(e));
+ if (!isse) mySplitIN.ChangeFind(e).Clear();
+ }
     }
- }
- for (it.Initialize(mySplitON); it.More(); it.Next()) {
- const TopoDS_Shape& e = it.Key();
- if ( e.ShapeType() == TopAbs_EDGE ) {
- Standard_Boolean isse = BDS.IsSectionEdge(TopoDS::Edge(e));
- if (!isse) mySplitON.ChangeFind(e).Clear();
+ for (it.Initialize(mySplitON); it.More(); it.Next()) {
+ const TopoDS_Shape& e = it.Key();
+ if ( e.ShapeType() == TopAbs_EDGE ) {
+ Standard_Boolean isse = BDS.IsSectionEdge(TopoDS::Edge(e));
+ if (!isse) mySplitON.ChangeFind(e).Clear();
+ }
     }
   }
   myMergedOUT.Clear();
  

I understand that TopOpe* packages are deprecated, and we plan on moving away from using them.
Steps To ReproduceCompile OCCT 7.3.0 with -fsanitize=undefined and run the test suite.

Test case: bugs/vis/bug331_1.
TagsNo tags attached.
Test case numberNot needed
Attached Files

- Relationships
child of 0030557newkgv Open CASCADE Coding - eliminate errors reported by -fsanitize 

-  Notes
(0082883)
git (administrator)
2019-03-12 20:28

Branch CR30562 has been created by kgv.

SHA-1: 560f2083170d964fd9a340eceb2c2c438637261b


Detailed log of new commits:

Author: kgv
Date: Tue Mar 12 20:22:26 2019 +0300

    0030562: Coding - TopOpeBRepBuild_Builder use of null pointer
    
    TopOpeBRepBuild_Builder::Clear() - added NULL check.
(0082884)
kgv (developer)
2019-03-12 20:30

Note that you can prepare patches directly for git:
https://dev.opencascade.org/index.php?q=home/get_involved [^]
(0082885)
galbramc (reporter)
2019-03-12 20:36

I'm not sure I can get my organization to sign the agreement to get access to the repo...
(0082895)
kgv (developer)
2019-03-13 09:59

Please raise the patch.

Tested within CR30564:
http://jenkins-test-12.nnov.opencascade.com:8080/view/CR30564-master-KGV/view/COMPARE/ [^]
(0082905)
apn (administrator)
2019-03-13 11:49

Combination -
OCCT branch : CR30564
master SHA - ff1a9501d05da740074577bad046435d00fe4482
d67d4b811012eef8913d3c535c29654d0acf3c4c
Products branch : master SHA - 19cf12d4f918562ea1456aa224c6f7a64b9c4ad7
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: 16615.46999999998 / 16599.24999999996 [+0.10%]
Products
Total CPU difference: 9089.820000000022 / 9092.71000000004 [-0.03%]
Windows-64-VC14:
OCCT
Total CPU difference: 18003.609375 / 17985.28125 [+0.10%]
Products
Total CPU difference: 10497.203125 / 10460.953125 [+0.35%]

Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention
(0083085)
git (administrator)
2019-03-19 10:33

Branch CR30562 has been deleted by inv.

SHA-1: 560f2083170d964fd9a340eceb2c2c438637261b

- Related Changesets
occt: master a7fd4b1b
Timestamp: 2019-03-12 17:22:26
Author: kgv
Committer: apn
Details ] Diff ]
0030562: Coding - TopOpeBRepBuild_Builder use of null pointer

TopOpeBRepBuild_Builder::Clear() - added NULL check.
mod - src/TopOpeBRepBuild/TopOpeBRepBuild_Builder.cxx Diff ] File ]

- Issue History
Date Modified Username Field Change
2019-03-12 19:35 galbramc New Issue
2019-03-12 19:35 galbramc Assigned To => kgv
2019-03-12 19:47 kgv Relationship added child of 0030557
2019-03-12 20:28 git Note Added: 0082883
2019-03-12 20:30 kgv Note Added: 0082884
2019-03-12 20:36 galbramc Note Added: 0082885
2019-03-13 09:59 kgv Note Added: 0082895
2019-03-13 09:59 kgv Assigned To kgv => bugmaster
2019-03-13 09:59 kgv Status new => resolved
2019-03-13 09:59 kgv Product Version 7.3.0 => 5.2.2
2019-03-13 09:59 kgv Target Version => 7.4.0*
2019-03-13 09:59 kgv Status resolved => reviewed
2019-03-13 11:49 apn Test case number => Not needed
2019-03-13 11:49 apn Note Added: 0082905
2019-03-13 11:49 apn Status reviewed => tested
2019-03-15 18:09 kgv Steps to Reproduce Updated View Revisions
2019-03-17 15:40 apn Changeset attached => occt master a7fd4b1b
2019-03-17 15:40 apn Assigned To bugmaster => apn
2019-03-17 15:40 apn Status tested => verified
2019-03-17 15:40 apn Resolution open => fixed
2019-03-19 10:33 git Note Added: 0083085


Copyright © 2000 - 2019 MantisBT Team
Powered by Mantis Bugtracker