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
This commit is contained in:
Kent Mein
2005-12-21 16:18:59 +00:00
parent 0802a953d1
commit 441fe09832

View File

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