summaryrefslogtreecommitdiffhomepage
path: root/lexer.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2021-04-29 00:31:06 +0200
committerJo-Philipp Wich <jo@mein.io>2021-04-29 00:31:06 +0200
commitf73e20158641a96882565852d0e2a6bf1540d950 (patch)
tree800d1fbdfe4f068f897e794d7b114e3545099067 /lexer.c
parent86b4863837edbd9aaac1aeea3f0101076ef55f09 (diff)
lexer: fix infinite loop when parsing regexp literal at EOF
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'lexer.c')
-rw-r--r--lexer.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lexer.c b/lexer.c
index 0fbea79..6e1dcd9 100644
--- a/lexer.c
+++ b/lexer.c
@@ -663,8 +663,8 @@ parse_regexp(uc_lexer *lex)
case UT_LEX_PARSE_REGEX_FLAGS:
rv = (uc_token *)lex->lookbehind;
- while (lex->bufstart < lex->bufend) {
- switch (lex->bufstart[0]) {
+ while (lex->bufstart < lex->bufend || lex->eof) {
+ switch (lex->eof ? EOF : lex->bufstart[0]) {
case 'g':
buf_consume(lex, 1);
is_reg_global = true;