Commit 38e1766bc6e20108948aec8a0b222a4bad0254e9

Daniel Stone 2017-06-26T17:21:45

xkbcomp: Don't falsely promise from ExprResolveLhs Every user of ExprReturnLhs goes on to unconditionally dereference the field return, which can be NULL if xkb_intern_atom fails. Return false if this is the case, so we fail safely. testcase: splice geometry data into interp Signed-off-by: Daniel Stone <daniels@collabora.com>

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/xkbcomp/expr.c b/src/xkbcomp/expr.c
index 91713da..b5ab717 100644
--- a/src/xkbcomp/expr.c
+++ b/src/xkbcomp/expr.c
@@ -42,7 +42,7 @@ ExprResolveLhs(struct xkb_context *ctx, const ExprDef *expr,
         *elem_rtrn = NULL;
         *field_rtrn = xkb_atom_text(ctx, expr->ident.ident);
         *index_rtrn = NULL;
-        return true;
+        return (*field_rtrn != NULL);
     case EXPR_FIELD_REF:
         *elem_rtrn = xkb_atom_text(ctx, expr->field_ref.element);
         *field_rtrn = xkb_atom_text(ctx, expr->field_ref.field);