summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRan Benita <ran@unusedvar.com>2021-04-02 15:00:46 +0300
committerRan Benita <ran@unusedvar.com>2021-04-02 15:15:33 +0300
commit7e6d942a4f9ffc60b11bc62354b980340f181074 (patch)
treec04b0e518a7e93dc62bb327e1bb2ad46d6249369 /src
parent45b1ca22052b79c83bd96b7c5828add156768b8e (diff)
downloadxorg-lib-libxkbcommon-7e6d942a4f9ffc60b11bc62354b980340f181074.tar.gz
compose: fix max compose nodes check
Signed-off-by: Ran Benita <ran@unusedvar.com>
Diffstat (limited to 'src')
-rw-r--r--src/compose/parser.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/compose/parser.c b/src/compose/parser.c
index a47ae4b..08018f2 100644
--- a/src/compose/parser.c
+++ b/src/compose/parser.c
@@ -336,9 +336,10 @@ add_production(struct xkb_compose_table *table, struct scanner *s,
uint16_t *pptr = NULL;
struct compose_node *node = NULL;
- if (darray_size(table->nodes) + 1 == MAX_COMPOSE_NODES)
+ /* Warn before potentially going over the limit, discard silently after. */
+ if (darray_size(table->nodes) + production->len + MAX_LHS_LEN > MAX_COMPOSE_NODES)
scanner_warn(s, "too many sequences for one Compose file; will ignore further lines");
- if (darray_size(table->nodes) >= MAX_COMPOSE_NODES)
+ if (darray_size(table->nodes) + production->len >= MAX_COMPOSE_NODES)
return;
/*