mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-06-07 09:04:57 +02:00
require length
Ugh! I meant to do this long ago. It would have caught my blunder.
This commit is contained in:
parent
078f991c57
commit
ce19001238
@ -52,9 +52,6 @@ const LargestInt Value::minLargestInt = LargestInt(~(LargestUInt(-1) / 2));
|
|||||||
const LargestInt Value::maxLargestInt = LargestInt(LargestUInt(-1) / 2);
|
const LargestInt Value::maxLargestInt = LargestInt(LargestUInt(-1) / 2);
|
||||||
const LargestUInt Value::maxLargestUInt = LargestUInt(-1);
|
const LargestUInt Value::maxLargestUInt = LargestUInt(-1);
|
||||||
|
|
||||||
/// Unknown size marker
|
|
||||||
static const size_t unknown = (size_t)-1;
|
|
||||||
|
|
||||||
#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
|
#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
|
||||||
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) {
|
||||||
@ -83,10 +80,7 @@ static inline bool InRange(double d, T min, U max) {
|
|||||||
* @return Pointer on the duplicate instance of string.
|
* @return Pointer on the duplicate instance of string.
|
||||||
*/
|
*/
|
||||||
static inline char* duplicateStringValue(const char* value,
|
static inline char* duplicateStringValue(const char* value,
|
||||||
size_t length = unknown) {
|
size_t length) {
|
||||||
if (length == unknown)
|
|
||||||
length = strlen(value);
|
|
||||||
|
|
||||||
// Avoid an integer overflow in the call to malloc below by limiting length
|
// Avoid an integer overflow in the call to malloc below by limiting length
|
||||||
// to a sane value.
|
// to a sane value.
|
||||||
if (length >= (size_t)Value::maxInt)
|
if (length >= (size_t)Value::maxInt)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user