summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Ådahl <jadahl@gmail.com>2020-11-27 14:41:17 +0000
committerJonas Ådahl <jadahl@gmail.com>2020-11-27 17:22:40 +0000
commit8bfb103d1c4bb6cc80185eaf133d34e1bf24493e (patch)
tree314c85eca403da7033382ea140062416ae1112d5
parent48d4153c06979db1b21e82dc34d801c32ac80b9a (diff)
downloadmutter-8bfb103d1c4bb6cc80185eaf133d34e1bf24493e.tar.gz
barrier: Complain loudly if bogus barriers are created
The API allows for invalid barriers to be created; in an X11 session, this could result in involutary early exit, so guard against those with soft asserts. These will be logged in the journal as warnings, but will avoid the crash unless compiled out. Note that this doesn't fix the bug, it just makes it more detectable. Related: https://bugzilla.redhat.com/show_bug.cgi?id=1901610 (cherry picked from commit f5949af0bbbb84931382aeabc8dadd2c4e82b8e4) Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1613>
-rw-r--r--src/backends/meta-barrier.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/backends/meta-barrier.c b/src/backends/meta-barrier.c
index 71536c3d7..ea2a77c20 100644
--- a/src/backends/meta-barrier.c
+++ b/src/backends/meta-barrier.c
@@ -180,6 +180,10 @@ meta_barrier_constructed (GObject *object)
g_return_if_fail (priv->border.line.a.x == priv->border.line.b.x ||
priv->border.line.a.y == priv->border.line.b.y);
+ g_return_if_fail (priv->border.line.a.x >= 0);
+ g_return_if_fail (priv->border.line.a.y >= 0);
+ g_return_if_fail (priv->border.line.b.x >= 0);
+ g_return_if_fail (priv->border.line.b.y >= 0);
#if defined(HAVE_NATIVE_BACKEND)
if (META_IS_BACKEND_NATIVE (meta_get_backend ()))