raster pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=72f1a2600b97d4c3585ab647b1db43cce3e25081

commit 72f1a2600b97d4c3585ab647b1db43cce3e25081
Author: Carsten Haitzler (Rasterman) <[email protected]>
Date:   Wed Aug 13 20:57:33 2014 +0900

    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);

-- 


Reply via email to