From 72f1a2600b97d4c3585ab647b1db43cce3e25081 Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Wed, 13 Aug 2014 20:57:33 +0900 Subject: [PATCH] evas 3d - fix error handling for ftell from coverity coverity was right again - CID 1222453 - fix. --- src/lib/evas/canvas/evas_3d_mesh_loader_obj.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lib/evas/canvas/evas_3d_mesh_loader_obj.c b/src/lib/evas/canvas/evas_3d_mesh_loader_obj.c index 62eec5e..c6733a7 100644 --- a/src/lib/evas/canvas/evas_3d_mesh_loader_obj.c +++ b/src/lib/evas/canvas/evas_3d_mesh_loader_obj.c @@ -49,6 +49,11 @@ _file_to_buf(const char *file, long *length)//prepare text file for reading if (!file_for_print) return NULL; fseek(file_for_print, 0, SEEK_END);//set file_for_print to the end of file *length = ftell(file_for_print);//set current position of file_for_print + if (*length < 0) + { + fclose(file_for_print); + return NULL; + } buf = malloc(*length + 1); fseek(file_for_print, 0, SEEK_SET);//set file_for_print to the begining of file unused = fread(buf, *length, 1, file_for_print); -- 2.7.4