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 <alyssa@rosenzweig.io>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29772>
This commit is contained in:
Juan A. Suarez Romero 2024-06-18 17:59:41 +02:00 committed by Marge Bot
parent 017bd4bf25
commit 91593adc93

View file

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