File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -189,7 +189,16 @@ class JSON_Parser
189
189
const typename std::char_traits<CharType>::int_type m_eof;
190
190
size_t m_currentColumn;
191
191
size_t m_currentParsingDepth;
192
+
193
+ // On APPLE debug overflow happens around 80.
194
+ // The DEBUG macro is defined in XCode but we don't in our CMakeList
195
+ // so for now we will keep the same on debug and release. In the future
196
+ // this can be increase on release if necessary.
197
+ #if defined(__APPLE__)
198
+ static const size_t maxParsingDepth = 64 ;
199
+ #else
192
200
static const size_t maxParsingDepth = 128 ;
201
+ #endif
193
202
};
194
203
195
204
template <typename CharType>
Original file line number Diff line number Diff line change 1
- /* **
1
+ /* **
2
2
* ==++==
3
3
*
4
4
* Copyright (c) Microsoft Corporation. All rights reserved.
@@ -490,12 +490,20 @@ utility::string_t make_deep_json_string(size_t depth)
490
490
491
491
TEST (deeply_nested)
492
492
{
493
+ #if defined(__APPLE__)
494
+ size_t safeDepth = 64 ;
495
+ size_t overDepth = 65 ;
496
+ #else
497
+ size_t safeDepth = 128 ;
498
+ size_t overDepth = 129 ;
499
+ #endif
500
+
493
501
// This should parse without issues:
494
- auto strGood = make_deep_json_string (128 );
502
+ auto strGood = make_deep_json_string (safeDepth );
495
503
json::value::parse (strGood);
496
504
497
505
// But this one should throw:
498
- auto strBad = make_deep_json_string (129 );
506
+ auto strBad = make_deep_json_string (overDepth );
499
507
VERIFY_PARSING_THROW (json::value::parse (strBad));
500
508
}
501
509
You can’t perform that action at this time.
0 commit comments