MantisBT
Mantis Bug Tracker Workflow

View Issue Details Jump to Notes ] Related Changesets ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0026230Community[OCCT] OCCT:Modeling Algorithmspublic2015-05-18 16:132015-10-23 20:51
ReporterBenjaminBihler 
Assigned Tobugmaster 
PrioritynormalSeveritycrash 
StatusclosedResolutionfixed 
PlatformLinuxOSDebian 6.0OS Version32 bit
Product Version[OCCT] 6.7.1 
Target Version[OCCT] 6.9.1Fixed in Version[OCCT] 6.9.1 
Summary0026230: Segmentation fault because a NULL curve is used without precaution in case of a projection failure
DescriptionUnfortunately my example file is confidential, but I try to describe it as detailed as possible.

I call BOPTools_AlgoTools2D::CurveOnSurface(...) to get a Handle(Geom2d_Curve) for an edge on a face (but the edge is not a boundary edge of that face).

Finally we come down to BOPTools_AlgoTools2D::MakePCurveOnFace. Here it is tried three times to compute the projection of the curve onto the surface (around line 610 of BOPTools_AlgoTools2D.cxx). The first two times, if the projection fails and the result curve is still NULL, the projection is tried again with a raised tolerance. But when the third projection fails, this is not handled anymore. The resulting curve is a NULL handle and therefore I get a segmentation fault here when the statement

  BOPTools_AlgoTools2D::AdjustPCurveOnFace (aF, aFirst, aLast,
                                            aC2D, aC2DA);

(around line 621 of BOPTools_AlgoTools2D.cxx) is executed.

I would expect another aC2D.IsNull() check at the end of BOPTools_AlgoTools2D::MakePCurveOnFace and an error should be raised in this case.
Steps To ReproduceNot required
TagsNo tags attached.
Test case numberNot needed
Attached Files

- Relationships

-  Notes
(0041393)
git (administrator)
2015-05-21 16:53

Branch CR26230 has been created by ifv.

SHA-1: 5a07bb57f17ebfb987a9bcf4364920073101c282


Detailed log of new commits:

Author: ifv
Date: Thu May 21 16:29:18 2015 +0300

    0026230: Segmentation fault because a NULL curve is used without precaution in case of a projection failure
(0041394)
ifv (developer)
2015-05-21 16:54

branch CR26230 is ready for review
(0041395)
msv (developer)
2015-05-21 17:23

It is needed to check the pcurve for null not only in the methods of the class BOPTools_AlgoTools2D, but follow the caller of these methods everywhere in OCCT code and protect all found places.
(0041646)
BenjaminBihler (developer)
2015-05-28 12:29

Wouldn't it be sufficient to raise an error, if projection is not possible? Then the callers can handle this as they want. At least for me this would suffice.
(0041647)
msv (developer)
2015-05-28 12:38

After discussion, we came to conclusion that it is better to raise a C++ exception in the case of projection failure.
(0041651)
BenjaminBihler (developer)
2015-05-28 12:57

Might it be possible then to include this improvement into a release earlier than 7.1.0? It would really be helpful!
(0041664)
abv (manager)
2015-05-28 14:39

Mikhail, please reconsider your idea of raising exception: in most cases it is better to produce invalid shape (without pcurve), which still can be usable, than exception (which will never be usable and has big chance to cause serious troubles on the application level). Consider returning some result and error status if problem occurs.
(0041671)
msv (developer)
2015-05-28 15:17

Andrey, this method was developed to be used in the context of Boolean operations. Failure of pcurve construction cannot lead to a usable result of Boolean. Exception will be caught on the upper level of the algorithm, and error status will be set.
However, I think we should leave a corresponding warning in Doxygen documentation for all methods of this class (BOPTools), which will raise exception if projection is failure.
(0041673)
msv (developer)
2015-05-28 15:21

Benjamin, if the fix will be already in master when 7.0.0 will be prepared then certainly this fix will hit in the release.
(0041720)
git (administrator)
2015-05-29 13:55

Branch CR26230 has been updated forcibly by ifv.

SHA-1: 4b1a5d90d077c6eb71df42f311d7af843fdd8827
(0041750)
msv (developer)
2015-05-29 16:30

Reviewed.
(0041756)
git (administrator)
2015-05-29 17:08

Branch CR26230 has been updated forcibly by apv.

SHA-1: 1d42e8fa44d0e06e5dac40ec2b9c4be7d584a962
(0041757)
apv (tester)
2015-05-29 17:09

Branch CR26230 has been rebased on the current master
(0041811)
apv (tester)
2015-06-01 18:24

Dear BugMaster,

Branch CR26230 from occt git-repository (and master from products git-repository) was compiled on Linux, MacOS and Windows platforms and tested.
SHA-1: 1d42e8fa44d0e06e5dac40ec2b9c4be7d584a962

Number of compiler warnings:
occt component:
   Linux: 25 (25 on master)
   Windows: 0 (0 on master)
products component:
   Linux: 37 (37 on master)
   Windows: 0 (0 on master)

Regressions/Differences:
Not detected

Testing cases:
Not needed

Testing on Linux:
Total MEMORY difference: 96045957 / 96362479 [-0.33%]
Total CPU difference: 18211.99999999994 / 18304.16000000009 [-0.50%]

Testing on Windows:
Total MEMORY difference: 56696505 / 57009585 [-0.55%]
Total CPU difference: 17356.515258998883 / 17523.436328998818 [-0.95%]
(0044251)
git (administrator)
2015-08-14 10:59

Branch CR26230 has been deleted by inv.

SHA-1: 1d42e8fa44d0e06e5dac40ec2b9c4be7d584a962

- Related Changesets
occt: master b9a7d225
Timestamp: 2015-05-29 08:25:56
Author: ifv
Committer: bugmaster
Details ] Diff ]
0026230: Segmentation fault because a NULL curve is used without precaution in case of a projection failure
mod - src/BOPTools/BOPTools_AlgoTools2D.cdl Diff ] File ]
mod - src/BOPTools/BOPTools_AlgoTools2D.cxx Diff ] File ]

- Issue History
Date Modified Username Field Change
2015-05-18 16:13 BenjaminBihler New Issue
2015-05-18 16:13 BenjaminBihler Assigned To => msv
2015-05-18 17:06 msv Assigned To msv => ifv
2015-05-18 17:08 msv Target Version => 7.1.0
2015-05-21 16:53 git Note Added: 0041393
2015-05-21 16:54 ifv Note Added: 0041394
2015-05-21 16:54 ifv Assigned To ifv => msv
2015-05-21 16:54 ifv Status new => resolved
2015-05-21 16:54 ifv Steps to Reproduce Updated View Revisions
2015-05-21 17:23 msv Note Added: 0041395
2015-05-21 17:23 msv Status resolved => assigned
2015-05-21 17:23 msv Assigned To msv => ifv
2015-05-28 12:29 BenjaminBihler Note Added: 0041646
2015-05-28 12:38 msv Note Added: 0041647
2015-05-28 12:57 BenjaminBihler Note Added: 0041651
2015-05-28 14:39 abv Note Added: 0041664
2015-05-28 15:17 msv Note Added: 0041671
2015-05-28 15:21 msv Note Added: 0041673
2015-05-29 13:55 git Note Added: 0041720
2015-05-29 13:56 ifv Assigned To ifv => msv
2015-05-29 13:56 ifv Status assigned => resolved
2015-05-29 16:30 msv Note Added: 0041750
2015-05-29 16:30 msv Assigned To msv => bugmaster
2015-05-29 16:30 msv Status resolved => reviewed
2015-05-29 16:31 apv Assigned To bugmaster => apv
2015-05-29 17:08 git Note Added: 0041756
2015-05-29 17:09 apv Note Added: 0041757
2015-06-01 17:52 apv Test case number => Not needed
2015-06-01 18:24 apv Note Added: 0041811
2015-06-01 18:24 apv Assigned To apv => bugmaster
2015-06-01 18:24 apv Status reviewed => tested
2015-06-05 15:00 bugmaster Changeset attached => occt master b9a7d225
2015-06-05 15:00 bugmaster Status tested => verified
2015-06-05 15:00 bugmaster Resolution open => fixed
2015-06-08 12:32 bugmaster Target Version 7.1.0 => 7.0.0
2015-08-14 10:59 git Note Added: 0044251
2015-08-26 11:11 abv Target Version 7.0.0 => 6.9.1
2015-10-16 14:56 user533 Status verified => closed
2015-10-23 20:51 user533 Fixed in Version => 6.9.1


Copyright © 2000 - 2018 MantisBT Team
Powered by Mantis Bugtracker