summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2020-10-19 10:49:37 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2020-10-20 09:23:50 +1000
commitafdc9ceee707cba3164f892fc3309140480c9b82 (patch)
tree2e85593d1e71fec8a20d37b2188bc88312f3c8a5 /src
parent21e640fbc7ec2e53244e4e531ae7c32f249b023f (diff)
downloadxorg-lib-libxkbcommon-afdc9ceee707cba3164f892fc3309140480c9b82.tar.gz
xkbcomp: where a keysym cannot be resolved, set it to NoSymbol
Where resolve_keysym fails we warn but use the otherwise uninitialized variable as our keysym. That later ends up in the keymap as random garbage hex value. Simplest test case, set this in the 'us' keymap: key <TLDE> { [ xyz ] }; And without this patch we get random garbage: ./build/xkbcli-compile-keymap --layout us | grep TLDE: key <TLDE> { [ 0x018a5cf0 ] }; With this patch, we now get NoSymbol: ./build/xkbcli-compile-keymap --layout us | grep TLDE: key <TLDE> { [ NoSymbol ] };
Diffstat (limited to 'src')
-rw-r--r--src/xkbcomp/parser.y4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/xkbcomp/parser.y b/src/xkbcomp/parser.y
index 6dcb523..87dea65 100644
--- a/src/xkbcomp/parser.y
+++ b/src/xkbcomp/parser.y
@@ -726,8 +726,10 @@ KeySyms : OBRACE KeySymList CBRACE
KeySym : IDENT
{
- if (!resolve_keysym($1, &$$))
+ if (!resolve_keysym($1, &$$)) {
parser_warn(param, "unrecognized keysym \"%s\"", $1);
+ $$ = XKB_KEY_NoSymbol;
+ }
free($1);
}
| SECTION { $$ = XKB_KEY_section; }