[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45826] trunk/blender/source/blender/nodes /composite/nodes/node_composite_image.c: Fix for image node: has to check the number of actual node sockets before accessing the output data stack , to avoid reading uninitialized memory.

Lukas Toenne lukas.toenne at googlemail.com
Sat Apr 21 15:36:58 CEST 2012


Revision: 45826
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45826
Author:   lukastoenne
Date:     2012-04-21 13:36:57 +0000 (Sat, 21 Apr 2012)
Log Message:
-----------
Fix for image node: has to check the number of actual node sockets before accessing the output data stack, to avoid reading uninitialized memory.

Modified Paths:
--------------
    trunk/blender/source/blender/nodes/composite/nodes/node_composite_image.c

Modified: trunk/blender/source/blender/nodes/composite/nodes/node_composite_image.c
===================================================================
--- trunk/blender/source/blender/nodes/composite/nodes/node_composite_image.c	2012-04-21 13:08:26 UTC (rev 45825)
+++ trunk/blender/source/blender/nodes/composite/nodes/node_composite_image.c	2012-04-21 13:36:57 UTC (rev 45826)
@@ -461,6 +461,8 @@
 		else {
 			CompBuf *stackbuf = node_composit_get_image(rd, ima, iuser);
 			if (stackbuf) {
+				int num_outputs = BLI_countlist(&node->outputs);
+				
 				/*respect image premul option*/
 				if (stackbuf->type==CB_RGBA && ima->flag & IMA_DO_PREMUL) {
 					int i;
@@ -483,15 +485,16 @@
 					}
 				}
 			
-				/* put image on stack */	
-				out[0]->data= stackbuf;
+				/* put image on stack */
+				if (num_outputs > 0)
+					out[0]->data= stackbuf;
 				
 				/* alpha output */
-				if (out[1]->hasoutput)
+				if (num_outputs > 1 && out[1]->hasoutput)
 					out[1]->data= valbuf_from_rgbabuf(stackbuf, CHAN_A);
 				
 				/* Z output */
-				if (out[2]->hasoutput)
+				if (num_outputs > 2 && out[2]->hasoutput)
 					out[2]->data= node_composit_get_zimage(node, rd);
 				
 				/* preview */




More information about the Bf-blender-cvs mailing list