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: v2.7.13rc1~116^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=274a76323cb9998df0c1a4dc5b1820d70e0a1886;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 7e4a300a6f98..4fdbad939341 100644 --- a/Parser/tokenizer.c +++ b/Parser/tokenizer.c @@ -951,7 +951,7 @@ tok_nextc(register 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 {