mirror of
https://gitee.com/openharmony/third_party_jsoncpp
synced 2024-11-27 01:11:27 +00:00
Fix the parsing error when JSONCPP parses the value of 5E-324 with libc++
Signed-off-by: hufeng <hufeng20@huawei.com> Change-Id: I1aaef25e133af8a1177713280c2f6657db182e81
This commit is contained in:
parent
bd47b3c0be
commit
539859dc3d
@ -1666,6 +1666,12 @@ bool OurReader::decodeDouble(Token& token, Value& decoded) {
|
||||
const String buffer(token.start_, token.end_);
|
||||
IStringStream is(buffer);
|
||||
if (!(is >> value)) {
|
||||
// the value could be lower than numeric_limits<double>::min(), in this situtation we should return the value with the gurantee
|
||||
// of conversion which has been performed and no occurances of range error.
|
||||
if ((value > 0 && value < std::numeric_limits<double>::min()) || (value < 0 && value > -std::numeric_limits<double>::min())) {
|
||||
decoded = value;
|
||||
return true;
|
||||
}
|
||||
return addError(
|
||||
"'" + String(token.start_, token.end_) + "' is not a number.", token);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user