summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Zwoch <fzwoch@gmail.com>2020-11-26 08:59:44 +0000
committerJonas Ã…dahl <jadahl@gmail.com>2020-11-26 12:18:17 +0000
commita54d38e03e1d2c50668464ef1d5fabeee849456d (patch)
treecdf3856d902b0cfe451a17936913fd43309d715b
parent8e0e8ce6ee77ec69ec97e24b20cdcb919072d37c (diff)
downloadmutter-a54d38e03e1d2c50668464ef1d5fabeee849456d.tar.gz
screen-cast: Fix segfault when drawing cursor
Add a sanity check if the cursor is on screen and cursor texture data is available. This prevents a potential segfault when trying to access non-existing texture data. Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1446 (cherry picked from commit efb577efb0cd23e98caad1544f556cb82130f8e0) Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1606>
-rw-r--r--src/backends/meta-screen-cast-monitor-stream-src.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/backends/meta-screen-cast-monitor-stream-src.c b/src/backends/meta-screen-cast-monitor-stream-src.c
index 2a22dc535..ab3be9683 100644
--- a/src/backends/meta-screen-cast-monitor-stream-src.c
+++ b/src/backends/meta-screen-cast-monitor-stream-src.c
@@ -443,6 +443,9 @@ maybe_paint_cursor_sprite (MetaScreenCastMonitorStreamSrc *monitor_src,
cairo_surface_t *surface;
cairo_t *cr;
+ if (!is_cursor_in_stream (monitor_src))
+ return;
+
cursor_sprite = meta_cursor_renderer_get_cursor (cursor_renderer);
if (!cursor_sprite)
return;