From 1f0eb56d7cd1b24c21ac24112dfb41d3b29fb21c Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Mon, 18 May 2009 22:09:16 +0000 Subject: [PATCH] "This patch fixes an obvious buffer overrun in SelectInterestingSourceRegion()," from Jay Foad! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72049 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Frontend/TextDiagnosticPrinter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Frontend/TextDiagnosticPrinter.cpp b/lib/Frontend/TextDiagnosticPrinter.cpp index 09c29109f1..b1c05336c2 100644 --- a/lib/Frontend/TextDiagnosticPrinter.cpp +++ b/lib/Frontend/TextDiagnosticPrinter.cpp @@ -204,11 +204,11 @@ static void SelectInterestingSourceRegion(std::string &SourceLine, // Skip over any whitespace we see here; we're looking for // another bit of interesting text. - while (CaretEnd != SourceLength && isspace(SourceLine[NewEnd - 1])) + while (NewEnd != SourceLength && isspace(SourceLine[NewEnd - 1])) ++NewEnd; // Skip over this bit of "interesting" text. - while (CaretEnd != SourceLength && !isspace(SourceLine[NewEnd - 1])) + while (NewEnd != SourceLength && !isspace(SourceLine[NewEnd - 1])) ++NewEnd; if (NewEnd - CaretStart <= TargetColumns) { -- 2.40.0