diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2014-09-06 01:16:42 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2014-09-06 01:16:42 +0000 |
commit | 095b92e51b2fd06926549fbcfccc9ee2a31a18c7 (patch) | |
tree | 9f190c0422dbbff08b78a35affb3b5deb867f0e9 /llvm/lib/Support/APFloat.cpp | |
parent | ba1ecbc7d399a77b490583c24c8ba658a84b55b8 (diff) | |
download | bcm5719-llvm-095b92e51b2fd06926549fbcfccc9ee2a31a18c7.tar.gz bcm5719-llvm-095b92e51b2fd06926549fbcfccc9ee2a31a18c7.zip |
Check whether the iterator p == the end iterator before trying to dereference it. This is a speculative fix for a failure found on the valgrind buildbot triggered by a clang test.
llvm-svn: 217295
Diffstat (limited to 'llvm/lib/Support/APFloat.cpp')
-rw-r--r-- | llvm/lib/Support/APFloat.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Support/APFloat.cpp b/llvm/lib/Support/APFloat.cpp index 097986d3e7c..659914a85f5 100644 --- a/llvm/lib/Support/APFloat.cpp +++ b/llvm/lib/Support/APFloat.cpp @@ -212,15 +212,15 @@ skipLeadingZeroesAndAnyDot(StringRef::iterator begin, StringRef::iterator end, { StringRef::iterator p = begin; *dot = end; - while (*p == '0' && p != end) + while (p != end && *p == '0') p++; - if (*p == '.') { + if (p != end && *p == '.') { *dot = p++; assert(end - begin != 1 && "Significand has no digits"); - while (*p == '0' && p != end) + while (p != end && *p == '0') p++; } |