git.lucas.co / cce-compositor
Wayland compositor (wlroots)
git clone https://git.lucas.co/cce-compositor.git

commit9126b4e3d432c89a5018b910bf43fe573c58ef51
parent0982037e76
authorIsaac Freund <[email protected]>
date2025-03-10 07:53
security-context: fix assertion failure

This regression was caused by turning my brain off a bit too much during
the zig 0.14 upgrade.

(cherry picked from commit 8f4a746da0317d557b2b5e530bf73da969649e18)

 river/Server.zig | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/river/Server.zig b/river/Server.zig
index ce3d95a..1bea726 100644
--- a/river/Server.zig
+++ b/river/Server.zig
@@ -19,6 +19,7 @@ const Server = @This();
 const build_options = @import("build_options");
 const std = @import("std");
 const assert = std.debug.assert;
+const mem = std.mem;
 const posix = std.posix;
 const wlr = @import("wlroots");
 const wl = @import("wayland").server.wl;
@@ -272,13 +273,16 @@ fn allowlist(server: *Server, global: *const wl.Global) bool {
     // such as wl_output and wl_seat since the wl_global_create() function will
     // advertise the global to clients and invoke this filter before returning
     // the new global pointer.
-    //
+    if ((mem.orderZ(u8, global.getInterface().name, "wl_output") == .eq) or
+        (mem.orderZ(u8, global.getInterface().name, "wl_seat") == .eq))
+    {
+        return true;
+    }
+
     // For other globals I like the current pointer comparison approach as it
     // should catch river accidentally exposing multiple copies of e.g. wl_shm
     // with an assertion failure.
-    return global.getInterface() == wl.Output.interface or
-        global.getInterface() == wl.Seat.interface or
-        global == server.shm.global or
+    return global == server.shm.global or
         global == server.single_pixel_buffer_manager.global or
         global == server.viewporter.global or
         global == server.fractional_scale_manager.global or