From 6773ffa758ff8b15379ea4bc9c66165212df06a4 Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Mon, 3 Mar 2025 14:37:02 +0200 Subject: [PATCH] libweston: fix bitshift in weston_idalloc_get_id() Fixes the following UBSan error: ../../git/weston/libweston/id-number-allocator.c:140:16: runtime error: left shift of 1 by 31 places cannot be represented in type 'int' Signed-off-by: Pekka Paalanen --- libweston/id-number-allocator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libweston/id-number-allocator.c b/libweston/id-number-allocator.c index 86eb02d4f..0917601e0 100644 --- a/libweston/id-number-allocator.c +++ b/libweston/id-number-allocator.c @@ -137,7 +137,7 @@ weston_idalloc_get_id(struct weston_idalloc *idalloc) continue; /* Found free id, take it and set it to 1 on the bucket. */ - *bucket |= 1 << i; + *bucket |= (uint32_t)1 << i; id = (32 * idalloc->lowest_free_bucket) + i; /* Bucket may become full... */