Mesa (master): nv50: access only the available amount of textures

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


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

Author: Emil Velikov <emil.l.velikov at gmail.com>
Date:   Thu Jan 16 15:35:02 2014 +0000

nv50: access only the available amount of textures

The textures array is defined as a number of PIPE_MAX_SAMPLERS per shader stage.
Currently nv50 driver handles only 3 shader stages, thus we wreck chaos when
accessing array-out-of-bounds.

Fixes a segfault in piglit/bin/arb_texture_buffer_object-data-sync -fbo -auto

Cc: 9.1 9.2 10.0 <mesa-stable at lists.freedesktop.org>
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 |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/nouveau/nv50/nv50_context.c b/src/gallium/drivers/nouveau/nv50/nv50_context.c
index 11afc48..eb345dc 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_context.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_context.c
@@ -165,7 +165,7 @@ nv50_invalidate_resource_storage(struct nouveau_context *ctx,
    }
 
    if (res->bind & PIPE_BIND_SAMPLER_VIEW) {
-      for (s = 0; s < 5; ++s) {
+      for (s = 0; s < 3; ++s) {
       for (i = 0; i < nv50->num_textures[s]; ++i) {
          if (nv50->textures[s][i] &&
              nv50->textures[s][i]->texture == res) {




More information about the mesa-commit mailing list