mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-20 09:08:07 +02:00
draw: add lower-bound assert on shader_stage
draw_set_sampler_views asserts shader_stage < DRAW_MAX_SHADER_STAGE but not >= 0. MSVC's prefast static analyzer reports C33010 (UNCHECKED_LOWER_BOUND_FOR_ENUMINDEX) when shader_stage is subsequently used as an array subscript, since it cannot prove the non-negative side of the bound. Extending the existing assert to both sides silences the warning and is a real bound check. Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41447>
This commit is contained in:
parent
e2cd37e422
commit
427158f784
1 changed files with 1 additions and 1 deletions
|
|
@ -1055,7 +1055,7 @@ draw_set_sampler_views(struct draw_context *draw,
|
|||
struct pipe_sampler_view **views,
|
||||
unsigned num)
|
||||
{
|
||||
assert(shader_stage < DRAW_MAX_SHADER_STAGE);
|
||||
assert(shader_stage >= 0 && shader_stage < DRAW_MAX_SHADER_STAGE);
|
||||
assert(num <= PIPE_MAX_SHADER_SAMPLER_VIEWS);
|
||||
|
||||
draw_do_flush(draw, DRAW_FLUSH_STATE_CHANGE);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue