[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17200] trunk/blender/source/blender/ blenloader/intern/readfile.c: Fix for crash reading a peach file, chubbychestnut.blend.

Brecht Van Lommel brecht at blender.org
Mon Oct 27 16:22:56 CET 2008


Revision: 17200
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17200
Author:   blendix
Date:     2008-10-27 16:22:55 +0100 (Mon, 27 Oct 2008)

Log Message:
-----------
Fix for crash reading a peach file, chubbychestnut.blend. A do_versions
conversion was reading the mtex array in a library linked material. It
is however not guaranteed that direct_link_* was called  on the material
yet, so the array pointer is not always valid and it can crash.

Modified Paths:
--------------
    trunk/blender/source/blender/blenloader/intern/readfile.c

Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c	2008-10-26 21:15:08 UTC (rev 17199)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c	2008-10-27 15:22:55 UTC (rev 17200)
@@ -4921,6 +4921,12 @@
 			ma= newlibadr(fd, lib, me->mat[mf->mat_nr]);
 			texalpha = 0;
 
+			/* we can't read from this if it comes from a library,
+			 * because direct_link might not have happened on it,
+			 * so ma->mtex is not pointing to valid memory yet */
+			if(ma && ma->id.lib)
+				ma= NULL;
+
 			for(b=0; ma && b<MAX_MTEX; b++)
 				if(ma->mtex && ma->mtex[b] && ma->mtex[b]->mapto & MAP_ALPHA)
 					texalpha = 1;





More information about the Bf-blender-cvs mailing list