Mesa (master): svga: don't use uninitialized framebuffer state

Brian Paul brianp at kemper.freedesktop.org
Thu Oct 11 15:15:23 UTC 2012


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

Author: Brian Paul <brianp at vmware.com>
Date:   Wed Oct 10 18:31:52 2012 -0600

svga: don't use uninitialized framebuffer state

Only the first 'nr_cbufs' color buffers in the pipe_framebuffer_state are
valid.  The rest of the color buffer pointers might be unitialized.
Fixes a regression in the piglit fbo-srgb-blit test since changes in the
gallium blitter code.

NOTE: This is a candidate for the 9.0 branch (just to be safe).

Reviewed-by: Jose Fonseca <jfonseca at vmware.com>

---

 src/gallium/drivers/svga/svga_pipe_misc.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_pipe_misc.c b/src/gallium/drivers/svga/svga_pipe_misc.c
index 56f2599..2b6269a 100644
--- a/src/gallium/drivers/svga/svga_pipe_misc.c
+++ b/src/gallium/drivers/svga/svga_pipe_misc.c
@@ -107,8 +107,10 @@ static void svga_set_framebuffer_state(struct pipe_context *pipe,
       }
    }
 
-   for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++)
-      pipe_surface_reference(&dst->cbufs[i], fb->cbufs[i]);
+   for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) {
+      pipe_surface_reference(&dst->cbufs[i],
+                             (i < fb->nr_cbufs) ? fb->cbufs[i] : NULL);
+   }
    pipe_surface_reference(&dst->zsbuf, fb->zsbuf);
 
 




More information about the mesa-commit mailing list