mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 00:58:05 +02:00
nv50: assert before trying to out-of-bounds access samplers
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
This commit is contained in:
parent
6a53b81086
commit
3805a864b1
2 changed files with 4 additions and 0 deletions
|
|
@ -557,6 +557,7 @@ nv50_sampler_state_delete(struct pipe_context *pipe, void *hwcso)
|
|||
unsigned s, i;
|
||||
|
||||
for (s = 0; s < 3; ++s)
|
||||
assert(nv50_context(pipe)->num_samplers[s] <= PIPE_MAX_SAMPLERS);
|
||||
for (i = 0; i < nv50_context(pipe)->num_samplers[s]; ++i)
|
||||
if (nv50_context(pipe)->samplers[s][i] == hwcso)
|
||||
nv50_context(pipe)->samplers[s][i] = NULL;
|
||||
|
|
@ -572,6 +573,7 @@ nv50_stage_sampler_states_bind(struct nv50_context *nv50, int s,
|
|||
{
|
||||
unsigned i;
|
||||
|
||||
assert(nr <= PIPE_MAX_SAMPLERS);
|
||||
for (i = 0; i < nr; ++i) {
|
||||
struct nv50_tsc_entry *old = nv50->samplers[s][i];
|
||||
|
||||
|
|
@ -579,6 +581,7 @@ nv50_stage_sampler_states_bind(struct nv50_context *nv50, int s,
|
|||
if (old)
|
||||
nv50_screen_tsc_unlock(nv50->screen, old);
|
||||
}
|
||||
assert(nv50->num_samplers[s] <= PIPE_MAX_SAMPLERS);
|
||||
for (; i < nv50->num_samplers[s]; ++i)
|
||||
if (nv50->samplers[s][i])
|
||||
nv50_screen_tsc_unlock(nv50->screen, nv50->samplers[s][i]);
|
||||
|
|
|
|||
|
|
@ -309,6 +309,7 @@ nv50_validate_tsc(struct nv50_context *nv50, int s)
|
|||
unsigned i;
|
||||
boolean need_flush = FALSE;
|
||||
|
||||
assert(nv50->num_samplers[s] <= PIPE_MAX_SAMPLERS);
|
||||
for (i = 0; i < nv50->num_samplers[s]; ++i) {
|
||||
struct nv50_tsc_entry *tsc = nv50_tsc_entry(nv50->samplers[s][i]);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue