Bug#1087438: Generates incorect is_valid_enum checks for bitfields
Package: libwayland-bin
Version: 1.23.0-1+b1
Severity: important
Hi,
wayland-scanner <= 1.23.0 has a bug where it misgenerates the is_valid
checks for bitfields thus breaking compositors e.g. using recent wlroots
as they reject valid dmabuf or layer surface bitfields, e.g.:
```
static inline bool
zwlr_layer_surface_v1_anchor_is_valid(uint32_t value, uint32_t version) {
uint32_t valid = 0;
if (version >= 1)
valid |= ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP;
if (version >= 1)
valid |= ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM;
if (version >= 1)
valid |= ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT;
if (version >= 1)
valid |= ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT;
return (value & ~valid) == 0;
}
```
which fails for bitfields where more than one value is set.
This is fixed in upstream commit
f72f2aec55705faceaa6e1a40ad13d0f0b037cd2 and version 1.23.1.
where the check looks like
```
static inline bool
zwlr_layer_surface_v1_anchor_is_valid(uint32_t value, uint32_t version) {
uint32_t valid = 0;
if (version >= 1)
valid |= ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP;
if (version >= 1)
valid |= ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM;
if (version >= 1)
valid |= ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT;
if (version >= 1)
valid |= ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT;
return (value & ~valid) == 0;
}
```
Would be great if wayland could be updated in unstable.
Cheers,
-- Guido
-- System Information:
Debian Release: trixie/sid
APT prefers testing
APT policy: (990, 'testing'), (500, 'unstable-debug'), (500, 'testing-debug'), (500, 'unstable'), (1, 'experimental-debug'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: arm64
Kernel: Linux 6.11.4-amd64 (SMP w/12 CPU threads; PREEMPT)
Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages libwayland-bin depends on:
ii libc6 2.40-3
ii libexpat1 2.6.3-1
ii libxml2 2.12.7+dfsg+really2.9.14-0.1
libwayland-bin recommends no packages.
libwayland-bin suggests no packages.
-- no debconf information
Reply to: