diff options
author | Kent Mein <mein@cs.umn.edu> | 2007-06-05 19:43:20 +0400 |
---|---|---|
committer | Kent Mein <mein@cs.umn.edu> | 2007-06-05 19:43:20 +0400 |
commit | 0a436e01e269595377c01ca0b10c9df05cc426eb (patch) | |
tree | 2fa62e5f857dae369cf56b3daaf6f339e7377fb2 /source | |
parent | d01d36ddd63960ba6a88a3bb928371d92cd3a270 (diff) |
filelen is set to the return result of BLI_filesize
which can return -1. So lets check for -1 before calling malloc
and doing more work.
Another coverity fix.
Kent
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/exotic.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/exotic.c b/source/blender/blenkernel/intern/exotic.c index 9d5e76e9ce7..fe52a3fc198 100644 --- a/source/blender/blenkernel/intern/exotic.c +++ b/source/blender/blenkernel/intern/exotic.c @@ -1246,7 +1246,12 @@ static void read_inventor(char *str, struct ListBase *listb) error("Can't read file\n"); return; } + filelen= BLI_filesize(file); + if(filelen < 1) { + close(file); + return; + } maindata= MEM_mallocN(filelen, "leesInventor"); read(file, maindata, filelen); |