From: Benjamin Peterson Date: Mon, 19 Sep 2016 06:41:11 +0000 (-0700) Subject: properly handle the single null-byte file (closes #24022) X-Git-Tag: v3.4.6rc1~12 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=26d998cfdd1f843a154e5398d09c0270fa17aa30;p=thirdparty%2FPython%2Fcpython.git properly handle the single null-byte file (closes #24022) --- diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c index 1540d26d8b3b..1a8cf40c2ce4 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 {