aboutsummaryrefslogtreecommitdiffstats
path: root/lib
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
commitc6d0fe557f8572e57009692e12a574809f090420 (patch)
treee921f681c7620301b45bfe5ac278619a10b04b0b /lib
parent252763fb87f6470930ba1a281563e4ef1a383f9e (diff)
downloadexternal_llvm-c6d0fe557f8572e57009692e12a574809f090420.zip
external_llvm-c6d0fe557f8572e57009692e12a574809f090420.tar.gz
external_llvm-c6d0fe557f8572e57009692e12a574809f090420.tar.bz2
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')
-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 095395f..11c1e02 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;