From: Nathan Sidwell Date: Tue, 3 Nov 2020 16:32:42 +0000 (-0800) Subject: cpplib: Fix off-by-one error X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=082a7b239096caf422f7ef138e2729b2730c0d70;p=gcc.git cpplib: Fix off-by-one error I noticed a fencepost error in the preprocessor. We should be checking if the next char is at the limit, not the current char (which can't be, because we're looking at it). libcpp/ * lex.c (_cpp_clean_line): Fix DOS off-by-one error. --- diff --git a/libcpp/lex.c b/libcpp/lex.c index fb222924c8c..1d522030a3c 100644 --- a/libcpp/lex.c +++ b/libcpp/lex.c @@ -1062,7 +1062,7 @@ _cpp_clean_line (cpp_reader *pfile) d = (uchar *) s; /* Handle DOS line endings. */ - if (*s == '\r' && s != buffer->rlimit && s[1] == '\n') + if (*s == '\r' && s + 1 != buffer->rlimit && s[1] == '\n') s++; }