[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54499] trunk/blender/source/blender/imbuf /intern/rectop.c: Fix #34213: crash loading openexr multilayer with use alpha disabled.

Brecht Van Lommel brechtvanlommel at pandora.be
Tue Feb 12 15:58:58 CET 2013


Revision: 54499
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54499
Author:   blendix
Date:     2013-02-12 14:58:58 +0000 (Tue, 12 Feb 2013)
Log Message:
-----------
Fix #34213: crash loading openexr multilayer with use alpha disabled.

Modified Paths:
--------------
    trunk/blender/source/blender/imbuf/intern/rectop.c

Modified: trunk/blender/source/blender/imbuf/intern/rectop.c
===================================================================
--- trunk/blender/source/blender/imbuf/intern/rectop.c	2013-02-12 14:58:46 UTC (rev 54498)
+++ trunk/blender/source/blender/imbuf/intern/rectop.c	2013-02-12 14:58:58 UTC (rev 54499)
@@ -594,11 +594,17 @@
 void IMB_rectfill_alpha(ImBuf *ibuf, const float value)
 {
 	int i;
+
 	if (ibuf->rect_float) {
-		float *fbuf = ibuf->rect_float + 3;
+		float *fbuf;
+
+		if (ibuf->channels != 4) return;
+
+		fbuf = ibuf->rect_float + 3;
 		for (i = ibuf->x * ibuf->y; i > 0; i--, fbuf += 4) { *fbuf = value; }
 	}
-	else {
+
+	if (ibuf->rect) {
 		const unsigned char cvalue = value * 255;
 		unsigned char *cbuf = ((unsigned char *)ibuf->rect) + 3;
 		for (i = ibuf->x * ibuf->y; i > 0; i--, cbuf += 4) { *cbuf = cvalue; }




More information about the Bf-blender-cvs mailing list