diff options
author | Lukas Toenne <lukas.toenne@googlemail.com> | 2012-04-21 17:36:57 +0400 |
---|---|---|
committer | Lukas Toenne <lukas.toenne@googlemail.com> | 2012-04-21 17:36:57 +0400 |
commit | d02aed6c6474eafbcc312156d1debfccb230a00f (patch) | |
tree | 05031cc8d2316551bdf79b442513f6d1828b2753 /source/blender/nodes | |
parent | 7e7d28e3ad433285c205c4f44218b5b4c862c9ef (diff) |
Fix for image node: has to check the number of actual node sockets before accessing the output data stack, to avoid reading uninitialized memory.
Diffstat (limited to 'source/blender/nodes')
-rw-r--r-- | source/blender/nodes/composite/nodes/node_composite_image.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/source/blender/nodes/composite/nodes/node_composite_image.c b/source/blender/nodes/composite/nodes/node_composite_image.c index 323767b64b1..6a156c390a7 100644 --- a/source/blender/nodes/composite/nodes/node_composite_image.c +++ b/source/blender/nodes/composite/nodes/node_composite_image.c @@ -461,6 +461,8 @@ static void node_composit_exec_image(void *data, bNode *node, bNodeStack **UNUSE 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 @@ static void node_composit_exec_image(void *data, bNode *node, bNodeStack **UNUSE } } - /* 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 */ |