From 59bb0ff945f5dfd71647f5b5090fc0a048338158 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marcin=20=C5=9Alusarz?= Date: Fri, 24 Jul 2020 17:59:36 +0200 Subject: [PATCH] glsl: catch out of bounds access in the debug version MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Marcin Ślusarz Reviewed-by: Marek Olšák Part-of: --- src/compiler/glsl/lower_precision.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/compiler/glsl/lower_precision.cpp b/src/compiler/glsl/lower_precision.cpp index d03c66a..1f116cd 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) -- 2.7.4