[clang] [clang] Fix a possible out-of-bounds read (PR #80023)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 2 01:26:20 PST 2024
================
@@ -1251,7 +1251,7 @@ highlightLines(StringRef FileData, unsigned StartLineNumber,
unsigned LineLength = 0;
for (unsigned I = 0; I <= Spelling.size(); ++I) {
// This line is done.
- if (isVerticalWhitespace(Spelling[I]) || I == Spelling.size()) {
+ if (I == Spelling.size() || isVerticalWhitespace(Spelling.at(I))) {
----------------
cor3ntin wrote:
I won't insist but I'd rather remove the at.
It occurs to me that between the lack of warnings, and the fact that unit tests probably have color disabled, this won't be easy to test.... oh well
https://github.com/llvm/llvm-project/pull/80023
More information about the cfe-commits
mailing list