From 26d998cfdd1f843a154e5398d09c0270fa17aa30 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Sun, 18 Sep 2016 23:41:11 -0700 Subject: [PATCH] properly handle the single null-byte file (closes #24022) --- Parser/tokenizer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c index 1540d26d8b..1a8cf40c2c 100644 --- a/Parser/tokenizer.c +++ b/Parser/tokenizer.c @@ -1014,7 +1014,7 @@ tok_nextc(struct tok_state *tok) else { tok->done = E_OK; tok->inp = strchr(tok->buf, '\0'); - done = tok->inp[-1] == '\n'; + done = tok->inp == tok->buf || tok->inp[-1] == '\n'; } } else { -- 2.40.0