"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
diff --git a/lib/Frontend/TextDiagnosticPrinter.cpp b/lib/Frontend/TextDiagnosticPrinter.cpp
index 09c2910..b1c0533 100644
--- a/lib/Frontend/TextDiagnosticPrinter.cpp
+++ b/lib/Frontend/TextDiagnosticPrinter.cpp
@@ -204,11 +204,11 @@
 
       // 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) {