mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-08-06 03:26:31 -04:00
Update json_value.cpp
Fixing bug of sending a number that is a bit bigger than max<uint64_t> it returns 0: https://stackoverflow.com/questions/77261400/jsoncpp-do-not-protect-from-uint64-overflow-and-have-weird-behavior/77261716#77261716
This commit is contained in:
parent
bee2c1010c
commit
db53e6d939
@ -103,7 +103,7 @@ template <typename T> static inline double integerToDouble(T value) {
|
|||||||
template <typename T, typename U>
|
template <typename T, typename U>
|
||||||
static inline bool InRange(double d, T min, U max) {
|
static inline bool InRange(double d, T min, U max) {
|
||||||
return d >= integerToDouble(min) && d <= integerToDouble(max) &&
|
return d >= integerToDouble(min) && d <= integerToDouble(max) &&
|
||||||
!(static_cast<T>(d) == min && d != integerToDouble(min));
|
!(static_cast<T>(d) == min || d != integerToDouble(min));
|
||||||
}
|
}
|
||||||
#endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
|
#endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user