iris: verify color component width in convert_fast_clear_color
authorMarcin Ślusarz <marcin.slusarz@intel.com>
Thu, 30 Jul 2020 12:40:21 +0000 (14:40 +0200)
committerMarge Bot <eric+marge@anholt.net>
Wed, 2 Sep 2020 15:08:01 +0000 (15:08 +0000)
Coverity complains about possible 2^32-1 bit shift.

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6126>

src/gallium/drivers/iris/iris_clear.c

index cf0699726fdcab188b0ab2cd10e424a99d70aeee..4171a876c768210c82363ae80a1c26329530f7d2 100644 (file)
@@ -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));