]> granicus.if.org Git - clang/commitdiff
"This patch fixes an obvious buffer overrun in
authorDouglas Gregor <dgregor@apple.com>
Mon, 18 May 2009 22:09:16 +0000 (22:09 +0000)
committerDouglas Gregor <dgregor@apple.com>
Mon, 18 May 2009 22:09:16 +0000 (22:09 +0000)
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

index 09c29109f18f1edc2f33850a2bec42f3fa756564..b1c05336c239514338bc0c220d2564adda9f85e8 100644 (file)
@@ -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) {