forked from OSchip/llvm-project
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
This commit is contained in:
parent
874c92bd47
commit
b645fa13a9
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue