gallium/u_blitter: add lower-bound assert on target

blitter_get_fs_texfetch_col asserts target < PIPE_MAX_TEXTURE_TYPES
but not >= 0. MSVC's prefast static analyzer reports C33010
(UNCHECKED_LOWER_BOUND_FOR_ENUMINDEX) when target is later 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:
Tanner Van De Walle 2026-05-08 15:36:12 -07:00 committed by Marge Bot
parent 427158f784
commit 3ef1db42c7

View file

@ -968,7 +968,7 @@ static void *blitter_get_fs_texfetch_col(struct blitter_context_priv *ctx,
enum tgsi_return_type dtype;
unsigned type;
assert(target < PIPE_MAX_TEXTURE_TYPES);
assert(target >= 0 && target < PIPE_MAX_TEXTURE_TYPES);
if (util_format_is_pure_uint(src_format)) {
stype = TGSI_RETURN_TYPE_UINT;