From fe57394c1e68833206b9ee0f86b06afd99dc45e1 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Thu, 5 Nov 2020 09:34:04 -0500 Subject: [PATCH] Fix invalid float with no leading integer --- ext/liquid_c/lexer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/liquid_c/lexer.c b/ext/liquid_c/lexer.c index 9f391559..75e25bee 100644 --- a/ext/liquid_c/lexer.c +++ b/ext/liquid_c/lexer.c @@ -109,7 +109,7 @@ const char *lex_one(const char *start, const char *end, lexer_token_t *token) } } - if (ISDIGIT(c) || c == '-') { + if (ISDIGIT(c) || (c == '-' && str + 1 < end && ISDIGIT(str[1]))) { int has_dot = 0; cur = str; while (++cur < end) {