summaryrefslogtreecommitdiff
path: root/src/modules/evas/model_savers
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_savers
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_savers')
-rw-r--r--src/modules/evas/model_savers/eet/evas_model_save_eet.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/modules/evas/model_savers/eet/evas_model_save_eet.c b/src/modules/evas/model_savers/eet/evas_model_save_eet.c
index ff43a3f851..0ac7e66e44 100644
--- a/src/modules/evas/model_savers/eet/evas_model_save_eet.c
+++ b/src/modules/evas/model_savers/eet/evas_model_save_eet.c
@@ -9,10 +9,6 @@
9#define COMPONENT_OF_DEFAULT_GREY_COLOR 0.3 9#define COMPONENT_OF_DEFAULT_GREY_COLOR 0.3
10#define TRANSPARENCY_OF_DEFAULT_GREY_COLOR 0.5 10#define TRANSPARENCY_OF_DEFAULT_GREY_COLOR 0.5
11 11
12extern Evas_Canvas3D_File_Eet* eet_file;
13extern const char EVAS_CANVAS3D_FILE_CACHE_FILE_ENTRY[];
14extern Eet_Data_Descriptor *_file_descriptor;
15
16void 12void
17_set_geometry_to_eet_file_from_mesh(Evas_Canvas3D_Mesh_Data *mesh, 13_set_geometry_to_eet_file_from_mesh(Evas_Canvas3D_Mesh_Data *mesh,
18 Evas_Canvas3D_Mesh_Eet *eet_mesh, 14 Evas_Canvas3D_Mesh_Eet *eet_mesh,
@@ -154,8 +150,10 @@ evas_model_save_file_eet(const Evas_Canvas3D_Mesh *mesh,
154 Eet_File *ef = eet_open(file, EET_FILE_MODE_WRITE); 150 Eet_File *ef = eet_open(file, EET_FILE_MODE_WRITE);
155 Evas_Canvas3D_Mesh_Eet* eet_mesh = malloc(sizeof(Evas_Canvas3D_Mesh_Eet)); 151 Evas_Canvas3D_Mesh_Eet* eet_mesh = malloc(sizeof(Evas_Canvas3D_Mesh_Eet));
156 Evas_Canvas3D_Header_Eet* eet_header = malloc(sizeof(Evas_Canvas3D_Header_Eet)); 152 Evas_Canvas3D_Header_Eet* eet_header = malloc(sizeof(Evas_Canvas3D_Header_Eet));
153 Eet_Data_Descriptor *_file_descriptor;
154 Evas_Canvas3D_File_Eet *eet_file;
157 155
158 _evas_canvas3d_eet_file_init(); 156 _file_descriptor = _evas_canvas3d_eet_file_get();
159 157
160 eet_file = _evas_canvas3d_eet_file_new(); 158 eet_file = _evas_canvas3d_eet_file_new();
161 159
@@ -176,7 +174,7 @@ evas_model_save_file_eet(const Evas_Canvas3D_Mesh *mesh,
176 ERR("Opening of file is failed."); 174 ERR("Opening of file is failed.");
177 free(eet_mesh); 175 free(eet_mesh);
178 free(eet_header); 176 free(eet_header);
179 _evas_canvas3d_eet_file_free(); 177 _evas_canvas3d_eet_file_free(eet_file);
180 return; 178 return;
181 } 179 }
182 180
@@ -190,6 +188,6 @@ evas_model_save_file_eet(const Evas_Canvas3D_Mesh *mesh,
190 EINA_TRUE); 188 EINA_TRUE);
191 eet_close(ef); 189 eet_close(ef);
192 190
193 _evas_canvas3d_eet_file_free(); 191 _evas_canvas3d_eet_file_free(eet_file);
194} 192}
195 193