From 2e04fa8872f38aea4eb96fd3424c3d6762b5262d Mon Sep 17 00:00:00 2001 From: Philip Date: Thu, 30 Apr 2015 19:07:44 +0000 Subject: [PATCH] fix end-of-buffer error in tccpp.c Quick fix for http://lists.nongnu.org/archive/html/tinycc-devel/2015-04/msg00160.html. I don't fully understand the intended semantics of when file->buf_ptr[0] is valid, but the rest of the code doesn't have any obvious spots with the same bug. Feel free to revert this if I'm mistaken or we need to discuss this change further. --- tccpp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tccpp.c b/tccpp.c index 62bfa9a..b44296d 100644 --- a/tccpp.c +++ b/tccpp.c @@ -2888,7 +2888,7 @@ static int macro_subst_tok(TokenString *tok_str, goto redo; } } else { - ch = file->buf_ptr[0]; + ch = tcc_peekc_slow(file); while (is_space(ch) || ch == '\n' || ch == '/') { if (ch == '/')