llvmpipe: validate color outputs against key->nr_cbufs
authorKeith Whitwell <keithw@vmware.com>
Fri, 15 Oct 2010 12:23:30 +0000 (13:23 +0100)
committerKeith Whitwell <keithw@vmware.com>
Fri, 15 Oct 2010 13:49:13 +0000 (14:49 +0100)
src/gallium/drivers/llvmpipe/lp_state_fs.c

index c4b1b868b65fcdc7a248af6f483b13717ffa2804..c070b55d3d101d913d7559d10775ba9eba260372 100644 (file)
@@ -404,7 +404,8 @@ generate_fs(struct llvmpipe_context *lp,
    /* Color write  */
    for (attrib = 0; attrib < shader->info.base.num_outputs; ++attrib)
    {
-      if (shader->info.base.output_semantic_name[attrib] == TGSI_SEMANTIC_COLOR)
+      if (shader->info.base.output_semantic_name[attrib] == TGSI_SEMANTIC_COLOR &&
+          shader->info.base.output_semantic_index[attrib] < key->nr_cbufs)
       {
          unsigned cbuf = shader->info.base.output_semantic_index[attrib];
          for(chan = 0; chan < NUM_CHANNELS; ++chan) {