nv50: assert before trying to out-of-bounds access framebuffer.cbufs
authorEmil Velikov <emil.l.velikov@gmail.com>
Thu, 16 Jan 2014 17:34:31 +0000 (17:34 +0000)
committerEmil Velikov <emil.l.velikov@gmail.com>
Sat, 18 Jan 2014 19:17:41 +0000 (19:17 +0000)
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
src/gallium/drivers/nouveau/nv50/nv50_context.c

index 8183b01cbfbe31ecaf990c131a0d20969c73f213..24264d5adbe51a37e01ff88c0a1e85c0076b1ef2 100644 (file)
@@ -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) {