security-context-v1: fix assertion failure
There's a bit of subtlety I missed with the zig-wayland upgrade. Since zig-wayland now generates its own wl_interface structs the pointer comparison we used to do here is no longer sufficient.
This commit is contained in:
		@ -19,6 +19,7 @@ const Server = @This();
 | 
				
			|||||||
const build_options = @import("build_options");
 | 
					const build_options = @import("build_options");
 | 
				
			||||||
const std = @import("std");
 | 
					const std = @import("std");
 | 
				
			||||||
const assert = std.debug.assert;
 | 
					const assert = std.debug.assert;
 | 
				
			||||||
 | 
					const mem = std.mem;
 | 
				
			||||||
const posix = std.posix;
 | 
					const posix = std.posix;
 | 
				
			||||||
const wlr = @import("wlroots");
 | 
					const wlr = @import("wlroots");
 | 
				
			||||||
const wl = @import("wayland").server.wl;
 | 
					const wl = @import("wayland").server.wl;
 | 
				
			||||||
@ -299,13 +300,16 @@ fn allowlist(server: *Server, global: *const wl.Global) bool {
 | 
				
			|||||||
    // such as wl_output and wl_seat since the wl_global_create() function will
 | 
					    // 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
 | 
					    // advertise the global to clients and invoke this filter before returning
 | 
				
			||||||
    // the new global pointer.
 | 
					    // 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
 | 
					    // For other globals I like the current pointer comparison approach as it
 | 
				
			||||||
    // should catch river accidentally exposing multiple copies of e.g. wl_shm
 | 
					    // should catch river accidentally exposing multiple copies of e.g. wl_shm
 | 
				
			||||||
    // with an assertion failure.
 | 
					    // with an assertion failure.
 | 
				
			||||||
    return global.getInterface() == wl.Output.interface or
 | 
					    return global == server.shm.global or
 | 
				
			||||||
        global.getInterface() == wl.Seat.interface or
 | 
					 | 
				
			||||||
        global == server.shm.global or
 | 
					 | 
				
			||||||
        global == server.single_pixel_buffer_manager.global or
 | 
					        global == server.single_pixel_buffer_manager.global or
 | 
				
			||||||
        global == server.viewporter.global or
 | 
					        global == server.viewporter.global or
 | 
				
			||||||
        global == server.fractional_scale_manager.global or
 | 
					        global == server.fractional_scale_manager.global or
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user