2 commits - src/cairo-xcb-connection.c
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Jan 13 16:52:24 UTC 2025
src/cairo-xcb-connection.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 727966dfca933d4a8fc6e65a428e1a9ce1a2fec2
Merge: 33173d9f1 6e0f76011
Author: Uli Schlachter <psychon at znc.in>
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 <bandithedoge at protonmail.com>
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) | \
More information about the cairo-commit
mailing list