diff options
-rw-r--r-- | src/xkbcomp/ast-build.c | 2 | ||||
-rw-r--r-- | src/xkbcomp/ast-build.h | 2 | ||||
-rw-r--r-- | src/xkbcomp/ast.h | 2 | ||||
-rw-r--r-- | src/xkbcomp/keycodes.c | 9 | ||||
-rw-r--r-- | src/xkbcomp/parser.y | 3 |
5 files changed, 13 insertions, 5 deletions
diff --git a/src/xkbcomp/ast-build.c b/src/xkbcomp/ast-build.c index dcfbb38..4ce4752 100644 --- a/src/xkbcomp/ast-build.c +++ b/src/xkbcomp/ast-build.c @@ -137,7 +137,7 @@ ExprCreateBinary(enum expr_op_type op, ExprDef *left, ExprDef *right) } KeycodeDef * -KeycodeCreate(xkb_atom_t name, unsigned long value) +KeycodeCreate(xkb_atom_t name, int64_t value) { KeycodeDef *def; diff --git a/src/xkbcomp/ast-build.h b/src/xkbcomp/ast-build.h index d433240..b600389 100644 --- a/src/xkbcomp/ast-build.h +++ b/src/xkbcomp/ast-build.h @@ -41,7 +41,7 @@ ExprDef * ExprCreateBinary(enum expr_op_type op, ExprDef *left, ExprDef *right); KeycodeDef * -KeycodeCreate(xkb_atom_t name, unsigned long value); +KeycodeCreate(xkb_atom_t name, int64_t value); KeyAliasDef * KeyAliasCreate(xkb_atom_t alias, xkb_atom_t real); diff --git a/src/xkbcomp/ast.h b/src/xkbcomp/ast.h index 4d8bc83..425e502 100644 --- a/src/xkbcomp/ast.h +++ b/src/xkbcomp/ast.h @@ -211,7 +211,7 @@ typedef struct _KeycodeDef { ParseCommon common; enum merge_mode merge; xkb_atom_t name; - unsigned long value; + int64_t value; } KeycodeDef; typedef struct _KeyAliasDef { diff --git a/src/xkbcomp/keycodes.c b/src/xkbcomp/keycodes.c index f134d85..4273ebe 100644 --- a/src/xkbcomp/keycodes.c +++ b/src/xkbcomp/keycodes.c @@ -461,7 +461,7 @@ HandleIncludeKeycodes(KeyNamesInfo *info, IncludeStmt *stmt) return (info->errorCount == 0); } -static int +static bool HandleKeycodeDef(KeyNamesInfo *info, KeycodeDef *stmt, enum merge_mode merge) { if (stmt->merge != MERGE_DEFAULT) { @@ -471,6 +471,13 @@ HandleKeycodeDef(KeyNamesInfo *info, KeycodeDef *stmt, enum merge_mode merge) merge = stmt->merge; } + if (stmt->value < 0 || stmt->value > XKB_KEYCODE_MAX) { + log_err(info->ctx, + "Illegal keycode %lld: must be between 0..%u; " + "Key ignored\n", stmt->value, XKB_KEYCODE_MAX); + return false; + } + return AddKeyName(info, stmt->value, stmt->name, merge, info->file_id, true); } diff --git a/src/xkbcomp/parser.y b/src/xkbcomp/parser.y index 3f0cc53..781a483 100644 --- a/src/xkbcomp/parser.y +++ b/src/xkbcomp/parser.y @@ -146,11 +146,12 @@ _xkbcommon_error(struct YYLTYPE *loc, struct parser_param *param, const char *ms %type <num> INTEGER FLOAT %type <str> IDENT STRING %type <sval> KEYNAME +%type <num> KeyCode %type <ival> Number Integer Float SignedNumber %type <merge> MergeMode OptMergeMode %type <file_type> XkbCompositeType FileType %type <uval> DoodadType -%type <mapFlags> Flag Flags OptFlags KeyCode +%type <mapFlags> Flag Flags OptFlags %type <str> MapName OptMapName KeySym %type <sval> FieldSpec Ident Element String %type <any> DeclList Decl |