MantisBT - Community
View Issue Details
0024590Community[OCCT] OCCT:Visualizationpublic2014-02-03 14:552014-11-11 12:51
Pawel 
apn 
normalcrash 
closedfixed 
WindowsVC++ 201264 bit
[OCCT] 6.7.0 
[OCCT] 6.8.0[OCCT] 6.8.0 
Not needed
0024590: Crash when processing OpenGl_BndBoxPrs objects
In OpenGL_SceneGeometry.cxx in the method:

Standard_Boolean IsRaytracedElement (const OpenGl_ElementNode* theNode)

on line 714 there is a cast:

OpenGl_PrimitiveArray* anArray = dynamic_cast< OpenGl_PrimitiveArray* > (theNode->elem);

The result is not checked against NULL. Although NULL is possible when theNode->elem is pointer to OpenGl_BndBoxPrs, which is not inherited from OpenGl_PrimitiveArray.


The code below called in

MyAISObject::Compute(const Handle_PrsMgr_PresentationManager3d& aPresentationManager,
                             const Handle_Prs3d_Presentation& aPresentation,
                             const Standard_Integer aMode)

causes crash during an attempt to highlight it.

Handle(Graphic3d_Structure) aStruct = Handle(Graphic3d_Structure)::DownCast(aPresentation);
aStruct->SetHighlightColor(HighlightColor);
aStruct->Highlight(Aspect_TOHM_BOUNDBOX);

Here is the call stack.

TKOpenGl.dll!OpenGl_PrimitiveArray::PArray() Line 48
TKOpenGl.dll!OpenGl_Raytrace::IsRaytracedElement(const OpenGl_ElementNode * theNode) Line 715
TKOpenGl.dll!OpenGl_Group::AddElement(const TelType theType, OpenGl_Element * theElem) Line 176
TKOpenGl.dll!OpenGl_Structure::SetHighlightBox(const Handle_OpenGl_Context & theGlCtx, const CALL_DEF_BOUNDBOX & theBoundBox) Line 286
TKOpenGl.dll!OpenGl_GraphicDriver::BoundaryBox(const Graphic3d_CStructure & theCStructure, const unsigned int toCreate) Line 76
TKV3d.dll!Graphic3d_Structure::GraphicHighlight(const Aspect_TypeOfHighlightMethod AMethod) Line 2328
No tags attached.
Issue History
2014-02-03 14:55PawelNew Issue
2014-02-03 14:55PawelAssigned To => Pawel
2014-02-03 15:56kgvNote Added: 0027737
2014-02-03 15:57kgvTarget Version => 6.7.1
2014-02-03 15:58kgvNote Edited: 0027737bug_revision_view_page.php?bugnote_id=27737#r6701
2014-02-03 16:39PawelNote Added: 0027738
2014-02-03 16:39PawelAssigned ToPawel => kgv
2014-02-03 16:39PawelStatusnew => resolved
2014-02-03 21:22kgvNote Added: 0027742
2014-02-03 21:22kgvAssigned Tokgv => apl
2014-02-04 11:22aplNote Added: 0027744
2014-02-04 11:22aplAssigned Toapl => bugmaster
2014-02-04 11:22aplStatusresolved => reviewed
2014-02-04 12:53mkvAssigned Tobugmaster => mkv
2014-02-05 11:22mkvNote Added: 0027757
2014-02-05 11:24mkvTest case number => Not needed
2014-02-05 11:24mkvAssigned Tomkv => bugmaster
2014-02-05 11:24mkvStatusreviewed => tested
2014-02-10 12:41apnChangeset attached => occt master 5322131b
2014-02-10 12:41apnAssigned Tobugmaster => apn
2014-02-10 12:41apnStatustested => verified
2014-02-10 12:41apnResolutionopen => fixed
2014-04-04 13:30abvTarget Version6.7.1 => 6.8.0
2014-11-11 12:47aivFixed in Version => 6.8.0
2014-11-11 12:51aivStatusverified => closed

Notes
(0027737)
kgv   
2014-02-03 15:56   
(edited on: 2014-02-03 15:58)
TelType is a rudiment of old TKOpenGl implementation which usage has been almost eliminated - TelText is the only one which is processed in special way in OpenGl_Group::Render() since TelMarker/TelMarkerSet no more exist.

So I consider removal of this ambiguous enumeration and field (fix OpenGl_Text if needed, fix raytracing code).

(0027738)
Pawel   
2014-02-03 16:39   
Dear kgv,

branch CR24590 pushed.

This is not exactly what you meant but it avoids the crash at least.
(0027742)
kgv   
2014-02-03 21:22   
Dear apl,

the patch that eliminates TelType enumeration is ready for review in CR24590_1 branch.
(0027744)
apl   
2014-02-04 11:22   
Dear Bugmaster,

The branch is reviewed.

Please test.
(0027757)
mkv   
2014-02-05 11:22   
Dear BugMaster,

Branch CR24590_1 (and products from GIT master) was compiled on Linux and Windows platforms and tested.
SHA-1: f3a702dd7d81700f8aeab6d6358123f585d5b3dd

Number of compiler warnings:

occt component :
Linux: 41 (44 on master)
Windows: 0 (0 on master)

products component :
Linux: 12 (12 on master)
Windows: 2 (2 on master)

Regressions/Differences:
No regressions/differences

Testing cases:
Not needed

Testing on Linux:
Total MEMORY difference: 371629920 / 372433200
Total CPU difference: 41234.97000000014 / 43920.07000000019

Testing on Windows:
Total MEMORY difference: 419555596 / 409848796
Total CPU difference: 33099.90625 / 35405.859375

There are not differences in images found by testdiff.