From 8f2a33cffcdffcd1d2564c8f495053c5e1d385f7 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 18 Apr 2023 17:44:47 +0200 Subject: [PATCH] server: stop wl_display_run() on dispatch error If wl_event_loop_dispatch() fails, we could enter an infinite loop, repeatedly calling a failing wl_event_loop_dispatch() forever. Signed-off-by: Simon Ser --- src/wayland-server.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/wayland-server.c b/src/wayland-server.c index d51acc6..51797bf 100644 --- a/src/wayland-server.c +++ b/src/wayland-server.c @@ -1490,7 +1490,9 @@ wl_display_run(struct wl_display *display) while (display->run) { wl_display_flush_clients(display); - wl_event_loop_dispatch(display->loop, -1); + if (wl_event_loop_dispatch(display->loop, -1) < 0) { + break; + } } }