summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Parser/tokenizer.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
index 4174e9c..3c82588 100644
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -873,6 +873,11 @@ tok_nextc(register struct tok_state *tok)
if (decoding_fgets(tok->inp,
(int)(tok->end - tok->inp),
tok) == NULL) {
+ /* Break out early on decoding
+ errors, as tok->buf will be NULL
+ */
+ if (tok->decoding_erred)
+ return EOF;
/* Last line does not end in \n,
fake one */
strcpy(tok->inp, "\n");