diff options
author | Ran Benita <ran234@gmail.com> | 2014-02-07 18:48:16 +0200 |
---|---|---|
committer | Ran Benita <ran234@gmail.com> | 2014-02-07 18:48:16 +0200 |
commit | e0137caceb5c48be7e570242898c0732deab1701 (patch) | |
tree | 81186229071db6c9af88d7c5c31028d5d275fa21 /src/xkbcomp/action.c | |
parent | b82a0a86504cd5ec279ffa3a967be4b22e3a7474 (diff) | |
download | libxkbcommon-e0137caceb5c48be7e570242898c0732deab1701.tar.gz libxkbcommon-e0137caceb5c48be7e570242898c0732deab1701.tar.bz2 libxkbcommon-e0137caceb5c48be7e570242898c0732deab1701.zip |
action: check range of MovePtr X,Y values
Signed-off-by: Ran Benita <ran234@gmail.com>
Diffstat (limited to 'src/xkbcomp/action.c')
-rw-r--r-- | src/xkbcomp/action.c | 13 |
1 files 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; |