From 91593adc9399b59b8fa28db6ffc731752c8ba5b6 Mon Sep 17 00:00:00 2001 From: "Juan A. Suarez Romero" Date: Tue, 18 Jun 2024 17:59:41 +0200 Subject: [PATCH] mesa: use unsigned types when performing bitshifting Ensure unsigned integers are used instead of signed ones when performing left bit shifts. This has been detected by the Undefined Behaviour Sanitizer (UBSan). Reviewed-by: Alyssa Rosenzweig Signed-off-by: Juan A. Suarez Romero Part-of: --- src/mesa/main/blend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c index e8c211ede61..d069943917b 100644 --- a/src/mesa/main/blend.c +++ b/src/mesa/main/blend.c @@ -1032,7 +1032,7 @@ _mesa_ColorMaski(GLuint buf, GLboolean red, GLboolean green, FLUSH_VERTICES(ctx, 0, GL_COLOR_BUFFER_BIT); ctx->NewDriverState |= ST_NEW_BLEND; - ctx->Color.ColorMask &= ~(0xf << (4 * buf)); + ctx->Color.ColorMask &= ~(0xfu << (4 * buf)); ctx->Color.ColorMask |= mask << (4 * buf); _mesa_update_allow_draw_out_of_order(ctx); }