Fixes #1122 where json_spirit could stack overflow because there

was no maximum limit set on the number of nested compound elements.
This commit is contained in:
Simon
2016-08-26 23:35:45 -07:00
parent 8b139c2441
commit df3af446e7
3 changed files with 24 additions and 0 deletions

View File

@@ -308,6 +308,12 @@ namespace json_spirit
}
else
{
// ZCASH: Prevent potential stack overflow by setting a limit on the number of nested compound elements
if (stack_.size() > 128) {
throw "too many nested elements";
}
// ENDZCASH
stack_.push_back( current_p_ );
Array_or_obj new_array_or_obj; // avoid copy by building new array or object in place