diff options
author | Kent Mein <mein@cs.umn.edu> | 2005-12-21 19:18:59 +0300 |
---|---|---|
committer | Kent Mein <mein@cs.umn.edu> | 2005-12-21 19:18:59 +0300 |
commit | 441fe09832381bd03369351f62bfd238f1b54aa4 (patch) | |
tree | 1a3e9cdc0c933a85ebf7b8d59e87315c8c3261ba | |
parent | 0802a953d170238262e201cbec88cb93cceb82e0 (diff) |
This fixes two things:
http://www.blender.org/forum/viewtopic.php?t=7646
and loading of old corrupt blendfiles.
Makes sure bhead.len is not < 0 (hacked blendfile)
also sets buffer to 0 when fails to read correctly (wasn't set so
was causing problems)
The second thing was provided by pidhash.
Kent
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index c72a88ca34c..96737509092 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -620,6 +620,9 @@ static BHeadN *get_bhead(FileData *fd) } } + /* make sure people are not trying to pass bad blend files */ + if (bhead.len < 0) fd->eof = 1; + // bhead now contains the (converted) bhead structure. Now read // the associated data and put everything in a BHeadN (creative naming !) @@ -634,6 +637,7 @@ static BHeadN *get_bhead(FileData *fd) if (readsize != bhead.len) { fd->eof = 1; MEM_freeN(new_bhead); + new_bhead = 0; } } else { fd->eof = 1; |