1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 12:43:36 +01:00

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
This commit is contained in:
Nick Lewycky 2014-09-06 01:16:42 +00:00
parent 9d03489b53
commit 820d92269f

View File

@ -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++;
}