[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13670] trunk/blender/source/blender/nodes /intern/CMP_nodes/CMP_glare.c: * fix for [#8085] Glare node crashes on inputs with < 4 colour channels

Matt Ebb matt at mke3.net
Wed Feb 13 14:36:35 CET 2008


Revision: 13670
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13670
Author:   broken
Date:     2008-02-13 14:36:35 +0100 (Wed, 13 Feb 2008)

Log Message:
-----------
* fix for [#8085] Glare node crashes on inputs with < 4 colour channels

I had this assigned to Alfredo for a while, but he hasn't replied to the tracker at all, so I suspect he's not around. I'll commit this now to prevent crashes.

Some of the code in the glare node assumed that all buffers will be 4 channel RGBA, when in fact it was possible to give it a VEC3, such as a spec pass with no alpha, which would crash it. This fix just duplicates the input to a new temporary RGBA buffer to work on, if it's not already RGBA.

Modified Paths:
--------------
    trunk/blender/source/blender/nodes/intern/CMP_nodes/CMP_glare.c

Modified: trunk/blender/source/blender/nodes/intern/CMP_nodes/CMP_glare.c
===================================================================
--- trunk/blender/source/blender/nodes/intern/CMP_nodes/CMP_glare.c	2008-02-13 13:26:46 UTC (rev 13669)
+++ trunk/blender/source/blender/nodes/intern/CMP_nodes/CMP_glare.c	2008-02-13 13:36:35 UTC (rev 13670)
@@ -424,15 +424,18 @@
 
 static void node_composit_exec_glare(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
 {
-	CompBuf *new, *img = in[0]->data;
+	CompBuf *new, *src, *img = in[0]->data;
 	NodeGlare* ndg = node->storage;
 
 	if ((img == NULL) || (out[0]->hasoutput == 0)) return;
 
-	if (img->type != CB_RGBA)
+	if (img->type != CB_RGBA) {
 		new = typecheck_compbuf(img, CB_RGBA);
-	else
+		src = typecheck_compbuf(img, CB_RGBA);
+	} else {
 		new = dupalloc_compbuf(img);
+		src = dupalloc_compbuf(img);
+	}
 
 	{
 		int x, y;
@@ -448,19 +451,20 @@
 
 	switch (ndg->type) {
 		case 0:
-			star4(ndg, new, img);
+			star4(ndg, new, src);
 			break;
 		case 1:
-			fglow(ndg, new, img);
+			fglow(ndg, new, src);
 			break;
 		case 3:
-			ghosts(ndg, new, img);
+			ghosts(ndg, new, src);
 			break;
 		case 2:
 		default:
-			streaks(ndg, new, img);
+			streaks(ndg, new, src);
 	}
 
+	free_compbuf(src);
 	out[0]->data = new;
 }
 





More information about the Bf-blender-cvs mailing list