[clang] 6d1d2c6 - [clang] Fix a possible out-of-bounds read (#80023)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 2 02:16:01 PST 2024
Author: Timm Baeder
Date: 2024-02-02T11:15:57+01:00
New Revision: 6d1d2c67e7597dc417c097d5027558b0159ed2e2
URL: https://github.com/llvm/llvm-project/commit/6d1d2c67e7597dc417c097d5027558b0159ed2e2
DIFF: https://github.com/llvm/llvm-project/commit/6d1d2c67e7597dc417c097d5027558b0159ed2e2.diff
LOG: [clang] Fix a possible out-of-bounds read (#80023)
Fixes #79964
Added:
Modified:
clang/lib/Frontend/TextDiagnostic.cpp
Removed:
################################################################################
diff --git a/clang/lib/Frontend/TextDiagnostic.cpp b/clang/lib/Frontend/TextDiagnostic.cpp
index 291d71f6db61f..627a7641308a1 100644
--- a/clang/lib/Frontend/TextDiagnostic.cpp
+++ b/clang/lib/Frontend/TextDiagnostic.cpp
@@ -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[I])) {
SmallVector<TextDiagnostic::StyleRange> &LineRanges =
SnippetRanges[L - StartLineNumber];
More information about the cfe-commits
mailing list