mirror of
https://gitee.com/openharmony/third_party_jsoncpp
synced 2024-12-04 05:26:28 +00:00
cac3aed223
Signed-off-by: fangyunzhong <fangyunzhong2@huawei.com>
18 lines
865 B
Diff
Executable File
18 lines
865 B
Diff
Executable File
diff --git a/src/lib_json/json_reader.cpp b/src/lib_json/json_reader.cpp
|
|
index f233abb..8f4c544 100755
|
|
--- a/src/lib_json/json_reader.cpp
|
|
+++ b/src/lib_json/json_reader.cpp
|
|
@@ -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);
|
|
}
|