summaryrefslogtreecommitdiff
path: root/src/modules/evas/model_loaders
diff options
context:
space:
mode:
authorPankaj Mittal <m.pankaj@samsung.com>2015-12-10 16:26:56 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-12-10 16:26:56 +0900
commit1363cd757a8dcdc9adeaf47f781ad038446b2014 (patch)
tree5cb4b8deb2c4627b57d170269f0fd2bbb244344c /src/modules/evas/model_loaders
parentd63cc52c584e0b3304699bd1822df18c0b446e2b (diff)
evas_eet: Add Type Safety check
Summary: The Function _evas_canvas3d_eet_file_free(void) is referenced in evas_model_load_file_eet()(file:evas_model_load_eet.c at line 122). This call is under condition if ((eet_file->mesh == NULL) || (eet_file->header == NULL)). when either eet_file->mesh or eet_file->header are NULL, dereference of the corresponding pointer in function "_evas_canvas3d_eet_file_free()" will generate Segmentation Fault. @fix Reviewers: raster, Hermet, tasn, wonsik, spacegrapher, cedric, jpeg Subscribers: singh.amitesh, sachin.dev, alok25, yashu21985, mvsovani, cedric Differential Revision: https://phab.enlightenment.org/D3369
Diffstat (limited to 'src/modules/evas/model_loaders')
-rw-r--r--src/modules/evas/model_loaders/eet/evas_model_load_eet.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/modules/evas/model_loaders/eet/evas_model_load_eet.c b/src/modules/evas/model_loaders/eet/evas_model_load_eet.c
index a36dff4..f5b1b6b 100644
--- a/src/modules/evas/model_loaders/eet/evas_model_load_eet.c
+++ b/src/modules/evas/model_loaders/eet/evas_model_load_eet.c
@@ -7,10 +7,6 @@
7#include "evas_common_private.h" 7#include "evas_common_private.h"
8#include "evas_private.h" 8#include "evas_private.h"
9 9
10extern Evas_Canvas3D_File_Eet* eet_file;
11extern const char EVAS_CANVAS3D_FILE_CACHE_FILE_ENTRY[];
12extern Eet_Data_Descriptor *_file_descriptor;
13
14void 10void
15_set_geometry_to_mesh_from_eet_file(Evas_Canvas3D_Mesh *mesh, 11_set_geometry_to_mesh_from_eet_file(Evas_Canvas3D_Mesh *mesh,
16 Evas_Canvas3D_Mesh_Eet *eet_mesh) 12 Evas_Canvas3D_Mesh_Eet *eet_mesh)
@@ -107,8 +103,11 @@ void
107evas_model_load_file_eet(Evas_Canvas3D_Mesh *mesh, Eina_File *file) 103evas_model_load_file_eet(Evas_Canvas3D_Mesh *mesh, Eina_File *file)
108{ 104{
109 Eet_File *ef; 105 Eet_File *ef;
106 Evas_Canvas3D_File_Eet* eet_file;
107 Eet_Data_Descriptor *_file_descriptor;
108
110 109
111 _evas_canvas3d_eet_file_init(); 110 _file_descriptor = _evas_canvas3d_eet_file_get();
112 ef = eet_mmap(file); 111 ef = eet_mmap(file);
113 eet_file = eet_data_read(ef, 112 eet_file = eet_data_read(ef,
114 _file_descriptor, 113 _file_descriptor,
@@ -119,14 +118,14 @@ evas_model_load_file_eet(Evas_Canvas3D_Mesh *mesh, Eina_File *file)
119 if ((eet_file->mesh == NULL) || (eet_file->header == NULL)) 118 if ((eet_file->mesh == NULL) || (eet_file->header == NULL))
120 { 119 {
121 ERR("Reading of file is failed."); 120 ERR("Reading of file is failed.");
122 _evas_canvas3d_eet_file_free(); 121 _evas_canvas3d_eet_file_free(eet_file);
123 return; 122 return;
124 } 123 }
125 124
126 _set_geometry_to_mesh_from_eet_file(mesh, eet_file->mesh); 125 _set_geometry_to_mesh_from_eet_file(mesh, eet_file->mesh);
127 _set_material_to_mesh_from_eet_file(mesh, eet_file->mesh); 126 _set_material_to_mesh_from_eet_file(mesh, eet_file->mesh);
128 127
129 _evas_canvas3d_eet_file_free(); 128 _evas_canvas3d_eet_file_free(eet_file);
130} 129}
131 130
132 131