Skip to content
Permalink
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
bluetech committed Jul 30, 2018
1 parent 917636b commit 842e435
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/compose/parser.c
Expand Up @@ -144,7 +144,7 @@ lex(struct scanner *s, union lvalue *val)

/* LHS Keysym. */
if (chr(s, '<')) {
while (peek(s) != '>' && !eol(s))
while (peek(s) != '>' && !eol(s) && !eof(s))
buf_append(s, next(s));
if (!chr(s, '>')) {
scanner_err(s, "unterminated keysym literal");
Expand Down

1 comment on commit 842e435

@msmeissn
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.