diff --git a/src/wayland/meta-wayland-wl-shell.c b/src/wayland/meta-wayland-wl-shell.c index 2557eea64..29b89f654 100644 --- a/src/wayland/meta-wayland-wl-shell.c +++ b/src/wayland/meta-wayland-wl-shell.c @@ -400,6 +400,10 @@ wl_shell_surface_set_title (struct wl_client *client, surface_from_wl_shell_surface_resource (resource); g_clear_pointer (&wl_shell_surface->title, g_free); + + if (!g_utf8_validate (title, -1, NULL)) + title = ""; + wl_shell_surface->title = g_strdup (title); if (surface->window) @@ -417,6 +421,10 @@ wl_shell_surface_set_class (struct wl_client *client, surface_from_wl_shell_surface_resource (resource); g_clear_pointer (&wl_shell_surface->wm_class, g_free); + + if (!g_utf8_validate (class_, -1, NULL)) + class_ = ""; + wl_shell_surface->wm_class = g_strdup (class_); if (surface->window) diff --git a/src/wayland/meta-wayland-xdg-shell.c b/src/wayland/meta-wayland-xdg-shell.c index 4c5e972ed..240970c08 100644 --- a/src/wayland/meta-wayland-xdg-shell.c +++ b/src/wayland/meta-wayland-xdg-shell.c @@ -136,6 +136,9 @@ xdg_surface_set_title (struct wl_client *client, { MetaWaylandSurface *surface = surface_from_xdg_surface_resource (resource); + if (!g_utf8_validate (title, -1, NULL)) + title = ""; + meta_window_set_title (surface->window, title); } @@ -146,6 +149,9 @@ xdg_surface_set_app_id (struct wl_client *client, { MetaWaylandSurface *surface = surface_from_xdg_surface_resource (resource); + if (!g_utf8_validate (app_id, -1, NULL)) + app_id = ""; + meta_window_set_wm_class (surface->window, app_id, app_id); }