summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nouveau/nv50/nv50_context.c
diff options
context:
space:
mode:
authorEmil Velikov <emil.l.velikov@gmail.com>2014-01-16 17:08:19 +0000
committerEmil Velikov <emil.l.velikov@gmail.com>2014-01-18 19:17:34 +0000
commit6a53b81086bd80ad5a5e79939e0aeb208253026a (patch)
tree7cbb229d7415f3ed857af46f5e083f52b07cde46 /src/gallium/drivers/nouveau/nv50/nv50_context.c
parent19069803bed95e64bf43185e7f02550ebbf92dde (diff)
downloadexternal_mesa3d-6a53b81086bd80ad5a5e79939e0aeb208253026a.zip
external_mesa3d-6a53b81086bd80ad5a5e79939e0aeb208253026a.tar.gz
external_mesa3d-6a53b81086bd80ad5a5e79939e0aeb208253026a.tar.bz2
nv50: assert before trying to out-of-bounds access textures
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Diffstat (limited to 'src/gallium/drivers/nouveau/nv50/nv50_context.c')
-rw-r--r--src/gallium/drivers/nouveau/nv50/nv50_context.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_context.c b/src/gallium/drivers/nouveau/nv50/nv50_context.c
index a4ec93a..8183b01 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_context.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_context.c
@@ -87,6 +87,7 @@ nv50_context_unreference_resources(struct nv50_context *nv50)
pipe_resource_reference(&nv50->idxbuf.buffer, NULL);
for (s = 0; s < 3; ++s) {
+ assert(nv50->num_textures[s] <= PIPE_MAX_SAMPLERS);
for (i = 0; i < nv50->num_textures[s]; ++i)
pipe_sampler_view_reference(&nv50->textures[s][i], NULL);
@@ -168,6 +169,7 @@ nv50_invalidate_resource_storage(struct nouveau_context *ctx,
if (res->bind & PIPE_BIND_SAMPLER_VIEW) {
for (s = 0; s < 3; ++s) {
+ assert(nv50->num_textures[s] <= PIPE_MAX_SAMPLERS);
for (i = 0; i < nv50->num_textures[s]; ++i) {
if (nv50->textures[s][i] &&
nv50->textures[s][i]->texture == res) {