mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-06-10 02:07:35 +02:00
Fix number reading in the presence of Infinity: Only check for infinity if we have a leading sign character.
This commit is contained in:
parent
4cea1f6f6c
commit
68509e6161
@ -988,7 +988,7 @@ private:
|
|||||||
bool readCppStyleComment();
|
bool readCppStyleComment();
|
||||||
bool readString();
|
bool readString();
|
||||||
bool readStringSingleQuote();
|
bool readStringSingleQuote();
|
||||||
bool readNumber();
|
bool readNumber(bool checkInf);
|
||||||
bool readValue();
|
bool readValue();
|
||||||
bool readObject(Token& token);
|
bool readObject(Token& token);
|
||||||
bool readArray(Token& token);
|
bool readArray(Token& token);
|
||||||
@ -1246,8 +1246,11 @@ bool OurReader::readToken(Token& token) {
|
|||||||
case '7':
|
case '7':
|
||||||
case '8':
|
case '8':
|
||||||
case '9':
|
case '9':
|
||||||
|
token.type_ = tokenNumber;
|
||||||
|
readNumber(false);
|
||||||
|
break;
|
||||||
case '-':
|
case '-':
|
||||||
if (readNumber()) {
|
if (readNumber(true)) {
|
||||||
token.type_ = tokenNumber;
|
token.type_ = tokenNumber;
|
||||||
} else {
|
} else {
|
||||||
token.type_ = tokenNegInf;
|
token.type_ = tokenNegInf;
|
||||||
@ -1382,9 +1385,9 @@ bool OurReader::readCppStyleComment() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OurReader::readNumber() {
|
bool OurReader::readNumber(bool checkInf) {
|
||||||
const char *p = current_;
|
const char *p = current_;
|
||||||
if (p != end_ && *p == 'I') {
|
if (checkInf && p != end_ && *p == 'I') {
|
||||||
current_ = ++p;
|
current_ = ++p;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user