From: Marcin Ślusarz Date: Fri, 24 Jul 2020 15:59:36 +0000 (+0200) Subject: glsl: catch out of bounds access in the debug version X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=59bb0ff945f5dfd71647f5b5090fc0a048338158;p=mesa.git glsl: catch out of bounds access in the debug version Signed-off-by: Marcin Ślusarz Reviewed-by: Marek Olšák Part-of: --- diff --git a/src/compiler/glsl/lower_precision.cpp b/src/compiler/glsl/lower_precision.cpp index d03c66a5dc0..1f116cd40ff 100644 --- a/src/compiler/glsl/lower_precision.cpp +++ b/src/compiler/glsl/lower_precision.cpp @@ -445,8 +445,9 @@ is_lowerable_builtin(ir_call *ir, */ const struct util_format_description *desc = util_format_description(resource->data.image_format); - unsigned i = + int i = util_format_get_first_non_void_channel(resource->data.image_format); + assert(i >= 0); if (desc->channel[i].pure_integer || desc->channel[i].type == UTIL_FORMAT_TYPE_FLOAT)