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 <pekka.paalanen@collabora.com>
This commit is contained in:
Pekka Paalanen 2025-03-03 14:37:02 +02:00
parent ed51e9ae43
commit 6773ffa758

View file

@ -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... */