summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/APFloat.cpp
diff options
context:
space:
mode:
authorNAKAMURA Takumi <geek4civic@gmail.com>2012-02-19 03:18:29 +0000
committerNAKAMURA Takumi <geek4civic@gmail.com>2012-02-19 03:18:29 +0000
commit5adeb93d8a7de8da5533f79112b8ce740e5584b3 (patch)
tree39098be03676f14e1621cc9e2cf2f9d8a3870b34 /llvm/lib/Support/APFloat.cpp
parentda2ed648b59c6e6b3a66c35baaefdc894ab1dff4 (diff)
downloadbcm5719-llvm-5adeb93d8a7de8da5533f79112b8ce740e5584b3.tar.gz
bcm5719-llvm-5adeb93d8a7de8da5533f79112b8ce740e5584b3.zip
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
Diffstat (limited to 'llvm/lib/Support/APFloat.cpp')
-rw-r--r--llvm/lib/Support/APFloat.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Support/APFloat.cpp b/llvm/lib/Support/APFloat.cpp
index 8913dd6def5..525aea28c67 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;
OpenPOWER on IntegriCloud