From: Ran Benita Date: Fri, 7 Feb 2014 16:48:16 +0000 (+0200) Subject: action: check range of MovePtr X,Y values X-Git-Tag: xkbcommon-0.4.1~85 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e0137caceb5c48be7e570242898c0732deab1701;p=platform%2Fupstream%2Flibxkbcommon.git action: check range of MovePtr X,Y values Signed-off-by: Ran Benita --- 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;