MantisBT - Open CASCADE
View Issue Details
0027891Open CASCADE[OCCT] OCCT:Visualizationpublic2016-09-21 18:412016-12-09 16:38
abv 
kgv 
normalminor 
closedfixed 
 
[OCCT] 7.1.0[OCCT] 7.1.0 
bugs vis bug26344
0027891: Visualization - FPE due to use of DBL_MAX in SelectMgr_SelectingVolumeManager::DetectedPoint()
When FPE signals are enabled (see 0026329), test bugs vis bug26344 crashes with Floating-point overflow exception. This problem is new one, it appeared after integration of fix for #27834.

There are several problems:

1. Method SelectMgr_SelectingVolumeManager::DetectedPoint(), and some others, use floating point values equal to RealLast() (DBL_MAX) in case of invalid situation. This is unsafe since the problem remains unnoticed and may lead to invalid calculation or FPE signal somewhere much farther in the code.

Please consider either raising exception, or using Precision::Infinite() instead of RealLast(). In either case, possibility to get such return value should be documented, and it should be properly treated by caller.

If possible, yet better solution would be changing signature of such methods to allow them returning success status explicitly.

2. Method SelectMgr_SelectingVolumeManager::DetectedPoint() gets called from method StdSelect_ViewerSelector3d::Pick() which corresponds to selection by window, while it may be called only when selection by single point is performed. This apparently indicates some logical error.

Call stack:

TKV3d.dll!gp_XYZ::Multiply(const gp_Mat & Matrix) Line 188 + 0xe bytes C++
TKV3d.dll!gp_GTrsf::Transforms(gp_XYZ & Coord) Line 162 C++
TKV3d.dll!`anonymous namespace'::updatePoint3d(SelectMgr_SortCriterion & theCriterion, const gp_GTrsf & theInversedTrsf, SelectMgr_SelectingVolumeManager & theMgr) Line 77 C++
TKV3d.dll!SelectMgr_ViewerSelector::checkOverlap(const opencascade::handle<SelectBasics_SensitiveEntity> & theEntity, const gp_GTrsf & theInversedTrsf, SelectMgr_SelectingVolumeManager & theMgr) Line 230 C++
TKV3d.dll!SelectMgr_ViewerSelector::traverseObject(const opencascade::handle<SelectMgr_SelectableObject> & theObject, const SelectMgr_SelectingVolumeManager & theMgr, const opencascade::handle<Graphic3d_Camera> & theCamera, const NCollection_Mat4<double> & theProjectionMat, const NCollection_Mat4<double> & theWorldViewMat, const int theViewportWidth, const int theViewportHeight) Line 379 + 0x22 bytes C++
TKV3d.dll!SelectMgr_ViewerSelector::TraverseSensitives() Line 513 C++
TKV3d.dll!StdSelect_ViewerSelector3d::Pick(const int theXPMin, const int theYPMin, const int theXPMax, const int theYPMax, const opencascade::handle<V3d_View> & theView) Line 160 C++
TKV3d.dll!AIS_InteractiveContext::Select(const int theXPMin, const int theYPMin, const int theXPMax, const int theYPMax, const opencascade::handle<V3d_View> & theView, const bool toUpdateViewer) Line 356 C++
Enable FPE signals handling in DRAW (e.g. switch to branch CR26329 and set CSF_FPE environment variable, or change Standard_False to Standard_True in calls to OSD::SetSignal() in DRAW) and then run:

test bugs vis bug26344
vstate -entities

Result - Draw Harness crashes.
No tags attached.
related to 0026329closed kgv Open CASCADE Restore floating point signals handling in DRAW 
Issue History
2016-09-21 18:41abvNew Issue
2016-09-21 18:41abvAssigned To => kgv
2016-09-21 18:43abvTest case number => bugs vis bug26344
2016-09-21 18:43abvSummaryVisualization - FPE due to use of DBL_MAX in => Visualization - FPE due to use of DBL_MAX in SelectMgr_SelectingVolumeManager::DetectedPoint()
2016-09-21 18:43abvDescription Updatedbug_revision_view_page.php?rev_id=14751#r14751
2016-09-21 18:44abvRelationship addedchild of 0027834
2016-09-21 18:44abvRelationship addedrelated to 0026329
2016-09-21 20:24kgvSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=14753#r14753
2016-09-22 10:46kgvSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=14758#r14758
2016-09-23 15:36gitNote Added: 0058078
2016-09-23 15:36kgvNote Added: 0058079
2016-09-23 15:36kgvAssigned Tokgv => san
2016-09-23 15:36kgvStatusnew => resolved
2016-09-23 16:16sanNote Added: 0058090
2016-09-23 16:16sanAssigned Tosan => bugmaster
2016-09-23 16:16sanStatusresolved => reviewed
2016-09-23 16:19mkvAssigned Tobugmaster => mkv
2016-09-26 12:58mkvNote Added: 0058157
2016-09-26 12:59mkvNote Added: 0058158
2016-09-26 12:59mkvAssigned Tomkv => kgv
2016-09-26 12:59mkvStatusreviewed => feedback
2016-09-26 14:11gitNote Added: 0058161
2016-09-26 14:13gitNote Added: 0058162
2016-09-26 14:13kgvNote Added: 0058163
2016-09-26 14:13kgvAssigned Tokgv => bugmaster
2016-09-26 14:13kgvStatusfeedback => reviewed
2016-09-26 15:23mkvAssigned Tobugmaster => mkv
2016-09-27 17:59mkvNote Added: 0058227
2016-09-27 17:59mkvNote Added: 0058228
2016-09-27 17:59mkvAssigned Tomkv => bugmaster
2016-09-27 17:59mkvStatusreviewed => tested
2016-10-03 13:47kgvChangeset attached => occt master 949c9b7f
2016-10-03 13:47kgvAssigned Tobugmaster => kgv
2016-10-03 13:47kgvStatustested => verified
2016-10-03 13:47kgvResolutionopen => fixed
2016-10-28 21:45gitNote Added: 0059528
2016-10-28 21:45gitNote Added: 0059529
2016-12-09 16:30aivStatusverified => closed
2016-12-09 16:38aivFixed in Version => 7.1.0

Notes
(0058078)
git   
2016-09-23 15:36   
Branch CR27891 has been created by kgv.

SHA-1: d3b7ce6a79ed1ee89a0eac883f2871f7289c0651


Detailed log of new commits:

Author: kgv
Date: Fri Sep 23 15:33:40 2016 +0300

    0027891: Visualization - FPE due to use of DBL_MAX in SelectMgr_SelectingVolumeManager::DetectedPoint()
(0058079)
kgv   
2016-09-23 15:36   
Patch is ready for review.
(0058090)
san   
2016-09-23 16:16   
Branch CR27891 reviewed without remarks, ready for testing.
(0058157)
mkv   
2016-09-26 12:58   
Dear BugMaster,
Branch CR27891 from occt git-repository (and master from products git-repository) was compiled on Linux, MacOS and Windows platforms and tested on Release mode.
SHA-1: d3b7ce6a79ed1ee89a0eac883f2871f7289c0651

Number of compiler warnings:

occt component :
Linux: 0 (0 on master)
Windows: 0 (0 on master)
MacOS : 0 (0 on master)

products component :
Linux: 64 (64 on master)
Windows: 0 (0 on master)
MacOS : 1147

Regressions/Differences/Improvements:
http://occt-tests/CR27891-master-OCCT/Debian70-64/bugs/vis/bug27477.html [^]
http://occt-tests/CR27891-master-OCCT/Windows-64-VC10/bugs/vis/bug27477.html [^]
bugs vis bug27477: FAILED

Testing cases:
http://occt-tests/CR27891-master-OCCT/Debian70-64/bugs/vis/bug26344.html [^]
http://occt-tests/CR27891-master-OCCT/Windows-64-VC10/bugs/vis/bug26344.html [^]
bugs vis bug26344: OK

Testing on Linux:
occt component :
Total MEMORY difference: 90946382 / 90233417 [+0.79%]
Total CPU difference: 19325.39999999984 / 19251.459999999875 [+0.38%]
products component :
Total MEMORY difference: 30027851 / 30046985 [-0.06%]
Total CPU difference: 5127.189999999981 / 5151.099999999975 [-0.46%]

Testing on Windows:
occt component :
Total MEMORY difference: 57213963 / 57221541 [-0.01%]
Total CPU difference: 17976.463232998743 / 18310.78897609872 [-1.83%]
products component :
Total MEMORY difference: 21271136 / 21235672 [+0.17%]
Total CPU difference: 4864.423181999953 / 4988.631178199945 [-2.49%]

There are no differences in images found by testdiff.
(0058158)
mkv   
2016-09-26 12:59   
Dear kgv,
Branch CR27891 has been rejected due to:
- regressions/differences/improvements
(0058161)
git   
2016-09-26 14:11   
Branch CR27891 has been updated by kgv.

SHA-1: f1e1e53e93e56052fa5cdcee75c4c610dafe20e7


Detailed log of new commits:

Author: kgv
Date: Mon Sep 26 14:09:26 2016 +0300

    adjust format for vstate command

(0058162)
git   
2016-09-26 14:13   
Branch CR27891_1 has been created by kgv.

SHA-1: f81159a8a0dfe74254e0fac7dc923496ac8277fe


Detailed log of new commits:

Author: kgv
Date: Fri Sep 23 15:33:40 2016 +0300

    0027891: Visualization - FPE due to use of DBL_MAX in SelectMgr_SelectingVolumeManager::DetectedPoint()
(0058163)
kgv   
2016-09-26 14:13   
Please check updated patch.
(0058227)
mkv   
2016-09-27 17:59   
Dear BugMaster,
Branch CR27891_1 from occt git-repository (and master from products git-repository) was compiled on Linux, MacOS and Windows platforms and tested on Release mode.
SHA-1: f81159a8a0dfe74254e0fac7dc923496ac8277fe

Number of compiler warnings:

occt component :
Linux: 0 (0 on master)
Windows: 0 (0 on master)
MacOS : 0 (0 on master)

products component :
Linux: 64 (64 on master)
Windows: 0 (0 on master)
MacOS : 1149

Regressions/Differences/Improvements:
No regressions/differences

Testing cases:
http://occt-tests/CR27891_1-master-OCCT/Debian70-64/bugs/vis/bug26344.html [^]
http://occt-tests/CR27891_1-master-OCCT/Windows-64-VC10/bugs/vis/bug26344.html [^]
bugs vis bug26344: OK

Testing on Linux:
occt component :
Total MEMORY difference: 90837119 / 90245681 [+0.66%]
Total CPU difference: 19387.38999999989 / 19252.119999999875 [+0.70%]
products component :
Total MEMORY difference: 30020603 / 30057668 [-0.12%]
Total CPU difference: 5151.279999999975 / 5152.399999999975 [-0.02%]

Testing on Windows:
occt component :
Total MEMORY difference: 57216643 / 57221541 [-0.01%]
Total CPU difference: 17855.78085939864 / 18310.78897609872 [-2.48%]
products component :
Total MEMORY difference: 21271951 / 21235672 [+0.17%]
Total CPU difference: 4901.863421999946 / 4988.631178199945 [-1.74%]

There are no differences in images found by testdiff.
(0058228)
mkv   
2016-09-27 17:59   
Dear BugMaster,
Branch CR27891_1 is TESTED.
(0059528)
git   
2016-10-28 21:45   
Branch CR27891 has been deleted by kgv.

SHA-1: f1e1e53e93e56052fa5cdcee75c4c610dafe20e7
(0059529)
git   
2016-10-28 21:45   
Branch CR27891_1 has been deleted by kgv.

SHA-1: f81159a8a0dfe74254e0fac7dc923496ac8277fe