Mesa (master): nv50: assert before trying to out-of-bounds access framebuffer.cbufs

Emil Velikov evelikov at kemper.freedesktop.org
Sat Jan 18 19:16:37 UTC 2014


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

Author: Emil Velikov <emil.l.velikov at gmail.com>
Date:   Thu Jan 16 17:34:31 2014 +0000

nv50: assert before trying to out-of-bounds access framebuffer.cbufs

Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>

---

 src/gallium/drivers/nouveau/nv50/nv50_context.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/src/gallium/drivers/nouveau/nv50/nv50_context.c b/src/gallium/drivers/nouveau/nv50/nv50_context.c
index 8183b01..24264d5 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_context.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_context.c
@@ -130,6 +130,7 @@ nv50_invalidate_resource_storage(struct nouveau_context *ctx,
    unsigned s, i;
 
    if (res->bind & PIPE_BIND_RENDER_TARGET) {
+      assert(nv50->framebuffer.nr_cbufs <= PIPE_MAX_COLOR_BUFS);
       for (i = 0; i < nv50->framebuffer.nr_cbufs; ++i) {
          if (nv50->framebuffer.cbufs[i] &&
              nv50->framebuffer.cbufs[i]->texture == res) {




More information about the mesa-commit mailing list