diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-06-15 19:20:28 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-06-15 19:20:28 +0000 |
commit | b645fa13a919d93798e2aa8b4fb8cc38c7d24012 (patch) | |
tree | ebb5845548e6b6bcf5387066a33eb0460e0205eb | |
parent | 874c92bd47797c7b7ba4dc46b8d7c6d6bf477972 (diff) | |
download | bcm5719-llvm-b645fa13a919d93798e2aa8b4fb8cc38c7d24012.tar.gz bcm5719-llvm-b645fa13a919d93798e2aa8b4fb8cc38c7d24012.zip |
fpcmp: Fix a possible infinite loop when comparing something like:
1..19 ok
to
1..20 o k
(yes, the odd space is necessary).
llvm-svn: 106032
-rw-r--r-- | llvm/lib/Support/FileUtilities.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Support/FileUtilities.cpp b/llvm/lib/Support/FileUtilities.cpp index 095395f1223..11c1e02abab 100644 --- a/llvm/lib/Support/FileUtilities.cpp +++ b/llvm/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; |