mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 02:10:11 +01:00
nv50: add missing brackets when handling the samplers array
Commit 3805a864b1d(nv50: assert before trying to out-of-bounds access samplers) introduced a series of asserts as a precausion of a previous illegal memory access. Although it failed to encapsulate loop within nv50_sampler_state_delete effectively failing to clear the sampler state, apart from exadurating the illegal memory access issue. Fixes gcc warning "array subscript is above array bounds" and "Nesting level does not match indentation" and "Out-of-bounds read" defects reported by Coverity. Cc: "10.1" <mesa-stable@lists.freedesktop.org> Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
This commit is contained in:
parent
4d0e30accd
commit
c26b488088
1 changed files with 2 additions and 1 deletions
|
|
@ -558,11 +558,12 @@ nv50_sampler_state_delete(struct pipe_context *pipe, void *hwcso)
|
|||
{
|
||||
unsigned s, i;
|
||||
|
||||
for (s = 0; s < 3; ++s)
|
||||
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;
|
||||
}
|
||||
|
||||
nv50_screen_tsc_free(nv50_context(pipe)->screen, nv50_tsc_entry(hwcso));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue