From 5adeb93d8a7de8da5533f79112b8ce740e5584b3 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Sun, 19 Feb 2012 03:18:29 +0000 Subject: [PATCH] APFloat::toString(): Fix overrun at scanning. FYI, clang/test/SemaTemplate/template-id-printing.cpp had been failing due to it on cygwin-clang. llvm-svn: 150911 --- llvm/lib/Support/APFloat.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/lib/Support/APFloat.cpp b/llvm/lib/Support/APFloat.cpp index 8913dd6def56..525aea28c676 100644 --- a/llvm/lib/Support/APFloat.cpp +++ b/llvm/lib/Support/APFloat.cpp @@ -3340,7 +3340,7 @@ namespace { // Rounding down is just a truncation, except we also want to drop // trailing zeros from the new result. if (buffer[FirstSignificant - 1] < '5') { - while (buffer[FirstSignificant] == '0') + while (FirstSignificant < N && buffer[FirstSignificant] == '0') FirstSignificant++; exp += FirstSignificant;