diff options
Diffstat (limited to 'libqpdf')
-rw-r--r-- | libqpdf/JSON.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libqpdf/JSON.cc b/libqpdf/JSON.cc index 407e4a64..44106688 100644 --- a/libqpdf/JSON.cc +++ b/libqpdf/JSON.cc @@ -1057,6 +1057,11 @@ JSONParser::handleToken() stack.push_back(item); } } + if (ps_stack.size() > 500) { + throw std::runtime_error( + "JSON: offset " + QUtil::int_to_string(p - cstr) + + ": maximum object depth exceeded"); + } parser_state = next_state; tok_start = nullptr; tok_end = nullptr; |