Mesa (master): llvmpipe: validate color outputs against key->nr_cbufs

Keith Whitwell keithw at kemper.freedesktop.org
Fri Oct 15 13:49:32 UTC 2010


Module: Mesa
Branch: master
Commit: ac98519c4eed0daf770a9ba380056978e4420352
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ac98519c4eed0daf770a9ba380056978e4420352

Author: Keith Whitwell <keithw at vmware.com>
Date:   Fri Oct 15 13:23:30 2010 +0100

llvmpipe: validate color outputs against key->nr_cbufs

---

 src/gallium/drivers/llvmpipe/lp_state_fs.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index c4b1b86..c070b55 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -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) {




More information about the mesa-commit mailing list