MantisBT - Open CASCADE
View Issue Details
0022777Open CASCADE[OCCT] OCCT:Visualizationpublic2011-10-24 16:272019-08-13 12:04
san 
kgv 
lowminor 
assignedopen 
ALL
[OCCT] 6.5.2 
[OCCT] 7.5.0 
0022777: Visualization - Unsafe way to get attribute values from MeshVS_Drawer
There are numerous locations in MeshVS package code where some attribute's value is obtained with help of MeshVS_Drawer::Get****() methods but the return status of these methods is not checked.
Meanwhile, the local variables that are used to store the attribute values are often not initialized properly.
This is done in assumption that the drawer instance has been initialized properly, but the drawer class itself does not have this initialization logic.

This leads to a situation when many local variables might potentially hold undefined values.

For (hopefully) all supported drawer attributes, MeshVS_Mesh constructor sets some meaningful defaults. However, if MeshVS_Mesh::SetDrawer() is called by an application and the new drawer is not initialized with good defaults for all supported attributes somewhere outside MeshVS package, this might lead to the above-mentioned troubles.

To eliminate completely this kind of problems, it is necessary to review MeshVS package sources and provide some initializers for the local variables used to store values obtained from the drawer.


Severity	Code	Description	Project	File	Line	Suppression State
Warning	C6031	Return value ignored: 'MeshVS_Drawer::GetColor'.	TKMeshVS	occt_vc14\src\meshvs\meshvs_vectorprsbuilder.cxx	
326	
Warning	C6031	Return value ignored: 'MeshVS_Drawer::GetInteger'.	TKMeshVS	occt_vc14\src\meshvs\meshvs_commonsensitiveentity.cxx	
37	
Warning	C6031	Return value ignored: 'MeshVS_Drawer::GetColor'.	TKMeshVS	occt_vc14\src\meshvs\meshvs_elementalcolorprsbuilder.cxx	
190	
Warning	C6031	Return value ignored: 'MeshVS_Drawer::GetColor'.	TKMeshVS	occt_vc14\src\meshvs\meshvs_elementalcolorprsbuilder.cxx	
191	
Warning	C6031	Return value ignored: 'MeshVS_Drawer::GetColor'.	TKMeshVS	occt_vc14\src\meshvs\meshvs_elementalcolorprsbuilder.cxx	
192	
Warning	C6031	Return value ignored: 'MeshVS_Drawer::GetDouble'.	TKMeshVS	occt_vc14\src\meshvs\meshvs_elementalcolorprsbuilder.cxx	
193	
Warning	C6031	Return value ignored: 'MeshVS_Drawer::GetDouble'.	TKMeshVS	occt_vc14\src\meshvs\meshvs_elementalcolorprsbuilder.cxx	
194	
Warning	C6031	Return value ignored: 'MeshVS_Drawer::GetBoolean'.	TKMeshVS	occt_vc14\src\meshvs\meshvs_elementalcolorprsbuilder.cxx	
195	
Warning	C6031	Return value ignored: 'MeshVS_Drawer::GetBoolean'.	TKMeshVS	occt_vc14\src\meshvs\meshvs_elementalcolorprsbuilder.cxx	
196	
Warning	C6031	Return value ignored: 'MeshVS_Drawer::GetBoolean'.	TKMeshVS	occt_vc14\src\meshvs\meshvs_elementalcolorprsbuilder.cxx	
197	
Warning	C6031	Return value ignored: 'MeshVS_Drawer::GetBoolean'.	TKMeshVS	occt_vc14\src\meshvs\meshvs_elementalcolorprsbuilder.cxx	
198	
Warning	C6031	Return value ignored: 'MeshVS_Drawer::GetBoolean'.	TKMeshVS	occt_vc14\src\meshvs\meshvs_mesh.cxx	
151	
Warning	C6031	Return value ignored: 'MeshVS_Drawer::GetBoolean'.	TKMeshVS	occt_vc14\src\meshvs\meshvs_mesh.cxx	
251	
Warning	C6031	Return value ignored: 'MeshVS_Drawer::GetBoolean'.	TKMeshVS	occt_vc14\src\meshvs\meshvs_meshprsbuilder.cxx	
117	
Warning	C6255	_alloca indicates failure by raising a stack overflow exception.  Consider using _malloca 
instead.	TKMeshVS	occt_vc14\src\meshvs\meshvs_meshprsbuilder.cxx	250	
Warning	C6255	_alloca indicates failure by raising a stack overflow exception.  Consider using _malloca 
instead.	TKMeshVS	occt_vc14\src\meshvs\meshvs_meshprsbuilder.cxx	251	
Warning	C6031	Return value ignored: 'MeshVS_Drawer::GetDouble'.	TKMeshVS	occt_vc14\src\meshvs\meshvs_meshprsbuilder.cxx	
199	
Warning	C6031	Return value ignored: 'MeshVS_Drawer::GetBoolean'.	TKMeshVS	occt_vc14\src\meshvs\meshvs_meshprsbuilder.cxx	
208	
Warning	C6031	Return value ignored: 'MeshVS_Drawer::GetBoolean'.	TKMeshVS	occt_vc14\src\meshvs\meshvs_meshprsbuilder.cxx	
209	
Warning	C6031	Return value ignored: 'MeshVS_Drawer::GetBoolean'.	TKMeshVS	occt_vc14\src\meshvs\meshvs_meshprsbuilder.cxx	
211	
Warning	C6031	Return value ignored: 'MeshVS_Drawer::GetMaterial'.	TKMeshVS	occt_vc14\src\meshvs\meshvs_meshprsbuilder.cxx	
219	
Warning	C6031	Return value ignored: 'MeshVS_Drawer::GetBoolean'.	TKMeshVS	occt_vc14\src\meshvs\meshvs_meshprsbuilder.cxx	
246	
Warning	C6031	Return value ignored: 'MeshVS_Drawer::GetMaterial'.	TKMeshVS	occt_vc14\src\meshvs\meshvs_meshprsbuilder.cxx	
535	
Warning	C6255	_alloca indicates failure by raising a stack overflow exception.  Consider using _malloca 
instead.	TKMeshVS	occt_vc14\src\meshvs\meshvs_meshprsbuilder.cxx	857	
Warning	C6263	Using _alloca in a loop:  this can quickly overflow stack.: Lines: 852	TKMeshVS	occt_vc14\src\meshvs\meshvs_meshprsbuilder.cxx	
857	
Warning	C6031	Return value ignored: 'MeshVS_Drawer::GetBoolean'.	TKMeshVS	occt_vc14\src\meshvs\meshvs_meshprsbuilder.cxx	
1062	
Warning	C6031	Return value ignored: 'MeshVS_Drawer::GetBoolean'.	TKMeshVS	occt_vc14\src\meshvs\meshvs_nodalcolorprsbuilder.cxx	
164	
Warning	C6031	Return value ignored: 'MeshVS_Drawer::GetBoolean'.	TKMeshVS	occt_vc14\src\meshvs\meshvs_nodalcolorprsbuilder.cxx	
165	
Warning	C6031	Return value ignored: 'MeshVS_Drawer::GetColor'.	TKMeshVS	occt_vc14\src\meshvs\meshvs_nodalcolorprsbuilder.cxx	
428	
Warning	C6031	Return value ignored: 'MeshVS_Drawer::GetColor'.	TKMeshVS	occt_vc14\src\meshvs\meshvs_nodalcolorprsbuilder.cxx	
429	
Warning	C6031	Return value ignored: 'MeshVS_Drawer::GetColor'.	TKMeshVS	occt_vc14\src\meshvs\meshvs_nodalcolorprsbuilder.cxx	
430	
Warning	C6031	Return value ignored: 'MeshVS_Drawer::GetDouble'.	TKMeshVS	occt_vc14\src\meshvs\meshvs_nodalcolorprsbuilder.cxx	
431	
Warning	C6031	Return value ignored: 'MeshVS_Drawer::GetBoolean'.	TKMeshVS	occt_vc14\src\meshvs\meshvs_nodalcolorprsbuilder.cxx	
432	
Warning	C6031	Return value ignored: 'MeshVS_Drawer::GetBoolean'.	TKMeshVS	occt_vc14\src\meshvs\meshvs_nodalcolorprsbuilder.cxx	
479	
Warning	C6031	Return value ignored: 'MeshVS_Drawer::GetColor'.	TKMeshVS	occt_vc14\src\meshvs\meshvs_textprsbuilder.cxx	
183	
Warning	C6031	Return value ignored: 'MeshVS_Drawer::GetDouble'.	TKMeshVS	occt_vc14\src\meshvs\meshvs_textprsbuilder.cxx	
184	
Warning	C6031	Return value ignored: 'MeshVS_Drawer::GetDouble'.	TKMeshVS	occt_vc14\src\meshvs\meshvs_textprsbuilder.cxx	
185	
N/A
No tags attached.
Issue History
2011-10-24 16:27sanNew Issue
2011-10-24 16:27sanAssigned To => san
2017-07-12 18:46mkvNote Added: 0068226
2017-07-12 18:46mkvAssigned Tosan => kgv
2017-07-12 18:46mkvStatusnew => assigned
2017-07-21 10:49kgvDescription Updatedbug_revision_view_page.php?rev_id=17146#r17146
2017-07-21 10:49kgvSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=17148#r17148
2017-07-21 10:50kgvSummaryUnsafe way to get attribute values from MeshVS_Drawer => Visualization - Unsafe way to get attribute values from MeshVS_Drawer
2017-07-21 10:53gitNote Added: 0068532
2017-07-21 10:54kgvTarget Version => 7.3.0
2018-03-13 15:04kgvTarget Version7.3.0 => 7.4.0*
2019-08-13 12:04kgvTarget Version7.4.0* => 7.5.0

Notes
(0068226)
mkv   
2017-07-12 18:46   
Dear kgv,
could you please put your opinion?
(0068532)
git   
2017-07-21 10:53   
Branch CR22777 has been created by kgv.

SHA-1: acb3cdf11b8cda1548a128001dc20cecb133418d


Detailed log of new commits:

Author: kgv
Date: Fri Jul 21 10:51:06 2017 +0300

    0022777: Visualization - Unsafe way to get attribute values from MeshVS_Drawer
    
    Define auxiliary macros Standard_CHECK_RETURN for asking compiler to warn about unused result.