Blame SOURCES/0010-Fail-expression-lookup-on-invalid-atoms.patch

a2d0a1
From 926df1e859345dc9e404ebf6d76599cf5b1e9b25 Mon Sep 17 00:00:00 2001
a2d0a1
From: Daniel Stone <daniels@collabora.com>
a2d0a1
Date: Mon, 30 Oct 2017 11:21:55 +0000
a2d0a1
Subject: [PATCH 10/10] Fail expression lookup on invalid atoms
a2d0a1
a2d0a1
If we fail atom lookup, then we should not claim that we successfully
a2d0a1
looked up the expression.
a2d0a1
a2d0a1
Signed-off-by: Daniel Stone <daniels@collabora.com>
a2d0a1
(cherry picked from commit bb4909d2d8fa6b08155e449986a478101e2b2634)
a2d0a1
---
a2d0a1
 src/xkbcomp/expr.c | 6 +++++-
a2d0a1
 1 file changed, 5 insertions(+), 1 deletion(-)
a2d0a1
a2d0a1
diff --git a/src/xkbcomp/expr.c b/src/xkbcomp/expr.c
a2d0a1
index 6640ed0..1b61ae5 100644
a2d0a1
--- a/src/xkbcomp/expr.c
a2d0a1
+++ b/src/xkbcomp/expr.c
a2d0a1
@@ -47,11 +47,15 @@ ExprResolveLhs(struct xkb_context *ctx, const ExprDef *expr,
a2d0a1
         *elem_rtrn = xkb_atom_text(ctx, expr->field_ref.element);
a2d0a1
         *field_rtrn = xkb_atom_text(ctx, expr->field_ref.field);
a2d0a1
         *index_rtrn = NULL;
a2d0a1
-        return true;
a2d0a1
+        return (*elem_rtrn != NULL && *field_rtrn != NULL);
a2d0a1
     case EXPR_ARRAY_REF:
a2d0a1
         *elem_rtrn = xkb_atom_text(ctx, expr->array_ref.element);
a2d0a1
         *field_rtrn = xkb_atom_text(ctx, expr->array_ref.field);
a2d0a1
         *index_rtrn = expr->array_ref.entry;
a2d0a1
+	if (expr->array_ref.element != XKB_ATOM_NONE && *elem_rtrn == NULL)
a2d0a1
+		return false;
a2d0a1
+	if (*field_rtrn == NULL)
a2d0a1
+		return false;
a2d0a1
         return true;
a2d0a1
     default:
a2d0a1
         break;
a2d0a1
--
a2d0a1
2.20.1