MantisBT
Mantis Bug Tracker Workflow

View Revisions: Issue #27891 All Revisions ] Back to Issue ]
Summary 0027891: Visualization - FPE due to use of DBL_MAX in SelectMgr_SelectingVolumeManager::DetectedPoint()
Revision 2016-09-21 18:43 by abv
Description 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++
Revision 2016-09-21 18:41 by abv
Description When FPE signals are enabled (see 0026329), test bugs vis bug26344 crashes with Floating-point overflow exception. This exhibits 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++


Copyright © 2000 - 2019 MantisBT Team
Powered by Mantis Bugtracker