From 5e676ac67171b93b0bd6be5d5b801087f305b2d5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marcin=20=C5=9Alusarz?= Date: Thu, 30 Jul 2020 14:40:21 +0200 Subject: [PATCH] iris: verify color component width in convert_fast_clear_color MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Coverity complains about possible 2^32-1 bit shift. Signed-off-by: Marcin Ślusarz Reviewed-by: Lionel Landwerlin Part-of: --- src/gallium/drivers/iris/iris_clear.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gallium/drivers/iris/iris_clear.c b/src/gallium/drivers/iris/iris_clear.c index cf0699726fd..4171a876c76 100644 --- a/src/gallium/drivers/iris/iris_clear.c +++ b/src/gallium/drivers/iris/iris_clear.c @@ -163,6 +163,7 @@ convert_fast_clear_color(struct iris_context *ice, for (int i = 0; i < 4; i++) { unsigned bits = util_format_get_component_bits( format, UTIL_FORMAT_COLORSPACE_RGB, i); + assert(bits > 0); if (bits < 32) { int32_t max = (1 << (bits - 1)) - 1; int32_t min = -(1 << (bits - 1)); -- 2.30.2