From gitlab-mirror at kemper.freedesktop.org Mon Jan 13 16:52:24 2025 From: gitlab-mirror at kemper.freedesktop.org (GitLab Mirror) Date: Mon, 13 Jan 2025 16:52:24 +0000 (UTC) Subject: 2 commits - src/cairo-xcb-connection.c Message-ID: <20250113165224.381C77618A@kemper.freedesktop.org> src/cairo-xcb-connection.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 727966dfca933d4a8fc6e65a428e1a9ce1a2fec2 Merge: 33173d9f1 6e0f76011 Author: Uli Schlachter Date: Mon Jan 13 16:52:21 2025 +0000 Merge branch 'depth-mask-ub' into 'master' cairo-xcb-connection.c: fix undefined behavior in DEPTH_MASK See merge request cairo/cairo!604 commit 6e0f760117c3b4417b98a3c2431c36d8909fbc06 Author: bandithedoge Date: Mon Jan 13 13:17:56 2025 +0100 cairo-xcb-connection.c: fix undefined behavior in DEPTH_MASK Bit-shifting a signed integer (which is what 1 is here) left is undefined behavior ? you can see it when compiling with `-fsanitize=undefined`. Explicitly declaring 1 as unsigned fixes this. diff --git a/src/cairo-xcb-connection.c b/src/cairo-xcb-connection.c index 213c920ac..016ca1c0c 100644 --- a/src/cairo-xcb-connection.c +++ b/src/cairo-xcb-connection.c @@ -239,7 +239,7 @@ _cairo_xcb_connection_parse_xrender_formats (cairo_xcb_connection_t *connection, /* * We require support for depth 1, 8, 24 and 32 pixmaps */ -#define DEPTH_MASK(d) (1 << ((d) - 1)) +#define DEPTH_MASK(d) ((uint32_t)(1) << ((d) - 1)) #define REQUIRED_DEPTHS (DEPTH_MASK(1) | \ DEPTH_MASK(8) | \ DEPTH_MASK(24) | \