summaryrefslogtreecommitdiff
path: root/lib/Support/FileUtilities.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-06-15 19:20:28 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-06-15 19:20:28 +0000
commitd1c82fe726a8776cb965c5bf1f6f6c0d311ef6bc (patch)
treee921f681c7620301b45bfe5ac278619a10b04b0b /lib/Support/FileUtilities.cpp
parent868ee9460c6e3055162f7ed9b05747606096945a (diff)
downloadllvm-d1c82fe726a8776cb965c5bf1f6f6c0d311ef6bc.tar.gz
llvm-d1c82fe726a8776cb965c5bf1f6f6c0d311ef6bc.tar.bz2
llvm-d1c82fe726a8776cb965c5bf1f6f6c0d311ef6bc.tar.xz
fpcmp: Fix a possible infinite loop when comparing something like:
1..19 ok to 1..20 o k (yes, the odd space is necessary). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106032 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/FileUtilities.cpp')
-rw-r--r--lib/Support/FileUtilities.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Support/FileUtilities.cpp b/lib/Support/FileUtilities.cpp
index 095395f122..11c1e02aba 100644
--- a/lib/Support/FileUtilities.cpp
+++ b/lib/Support/FileUtilities.cpp
@@ -51,7 +51,15 @@ static const char *BackupNumber(const char *Pos, const char *FirstChar) {
if (!isNumberChar(*Pos)) return Pos;
// Otherwise, return to the start of the number.
+ bool HasPeriod = false;
while (Pos > FirstChar && isNumberChar(Pos[-1])) {
+ // Backup over at most one period.
+ if (Pos[-1] == '.') {
+ if (HasPeriod)
+ break;
+ HasPeriod = true;
+ }
+
--Pos;
if (Pos > FirstChar && isSignedChar(Pos[0]) && !isExponentChar(Pos[-1]))
break;