Don't choke on RMLVO layout string with holes

This old rules parser gives the same kccgst here, so in the interest of
staying compatible we shouldn't fix it there. Similarly we shouldn't
touch ParseIncludeMap, so this is the best place to handle this.

Signed-off-by: Ran Benita <ran234@gmail.com>
master
Ran Benita 2012-09-21 11:14:39 +03:00 committed by Daniel Stone
parent bbaa11c6e3
commit c174173209
2 changed files with 16 additions and 0 deletions

View File

@ -403,6 +403,19 @@ IncludeCreate(struct xkb_context *ctx, char *str, enum merge_mode merge)
if (!ParseIncludeMap(&tmp, &file, &map, &nextop, &extra_data))
goto err;
/*
* Given an RMLVO (here layout) like 'us,,fr', the rules parser
* will give out something like 'pc+us+:2+fr:3+inet(evdev)'.
* We should just skip the ':2' in this case and leave it to the
* appropriate section to deal with the empty group.
*/
if (isempty(file)) {
free(file);
free(map);
free(extra_data);
continue;
}
if (first == NULL) {
first = incl = malloc(sizeof(*first));
} else {

View File

@ -110,6 +110,9 @@ int main(int argc, char *argv[])
/* 20 is not a legal group; make sure this is handled gracefully. */
assert(test_rmlvo(ctx, "evdev", "", "us:20", "", ""));
/* Don't choke on missing values in RMLVO. Should just skip them. */
assert(test_rmlvo(ctx, "evdev", "", "us,,ca", "", ""));
assert(test_rmlvo(ctx, "", "", "", "", ""));
assert(test_rmlvo(ctx, NULL, NULL, NULL, NULL, NULL));