Module: Mesa
Branch: master
Commit: 5e676ac67171b93b0bd6be5d5b801087f305b2d5
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5e676ac67171b93b0bd6be5d5b801087f305b2d5

Author: Marcin Ślusarz <[email protected]>
Date:   Thu Jul 30 14:40:21 2020 +0200

iris: verify color component width in convert_fast_clear_color

Coverity complains about possible 2^32-1 bit shift.

Signed-off-by: Marcin Ślusarz <[email protected]>
Reviewed-by: Lionel Landwerlin <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6126>

---

 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));

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to