From e26b5aa9c47fbc604c23efe9100940ff68d8ddbe Mon Sep 17 00:00:00 2001 From: Matt Ebb Date: Wed, 13 Feb 2008 13:36:35 +0000 Subject: * 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. --- source/blender/nodes/intern/CMP_nodes/CMP_glare.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'source/blender/nodes') diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_glare.c b/source/blender/nodes/intern/CMP_nodes/CMP_glare.c index e7b8fd00c93..9ab4038607f 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_glare.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_glare.c @@ -424,15 +424,18 @@ static void fglow(NodeGlare* ndg, CompBuf* dst, CompBuf* src) 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 @@ static void node_composit_exec_glare(void *data, bNode *node, bNodeStack **in, b 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; } -- cgit v1.2.3