From e0137caceb5c48be7e570242898c0732deab1701 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Fri, 7 Feb 2014 18:48:16 +0200 Subject: [PATCH] action: check range of MovePtr X,Y values Signed-off-by: Ran Benita --- src/xkbcomp/action.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/xkbcomp/action.c b/src/xkbcomp/action.c index 2bd0bd1..1b6a66c 100644 --- a/src/xkbcomp/action.c +++ b/src/xkbcomp/action.c @@ -469,15 +469,24 @@ HandleMovePtr(struct xkb_keymap *keymap, union xkb_action *action, if (!ExprResolveInteger(keymap->ctx, value, &val)) return ReportMismatch(keymap, action->type, field, "integer"); + if (val < INT16_MIN || val > INT16_MAX) { + log_err(keymap->ctx, + "The %s field in the %s action must be in range %d..%d; " + "Action definition ignored\n", + fieldText(field), ActionTypeText(action->type), + INT16_MIN, INT16_MAX); + return false; + } + if (field == ACTION_FIELD_X) { if (absolute) act->flags |= ACTION_ABSOLUTE_X; - act->x = val; + act->x = (int16_t) val; } else { if (absolute) act->flags |= ACTION_ABSOLUTE_Y; - act->y = val; + act->y = (int16_t) val; } return true; -- 2.7.4