Skip to content

Commit 842e435

Browse files
committed
compose: fix infinite loop in parser on some inputs
The parser would enter an infinite loop if an unterminated keysym literal occurs at EOF. Found with the afl fuzzer. Signed-off-by: Ran Benita <ran234@gmail.com>
1 parent 917636b commit 842e435

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: src/compose/parser.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ lex(struct scanner *s, union lvalue *val)
144144

145145
/* LHS Keysym. */
146146
if (chr(s, '<')) {
147-
while (peek(s) != '>' && !eol(s))
147+
while (peek(s) != '>' && !eol(s) && !eof(s))
148148
buf_append(s, next(s));
149149
if (!chr(s, '>')) {
150150
scanner_err(s, "unterminated keysym literal");

0 commit comments

Comments
 (0)