| 536 | } |
| 537 | |
| 538 | void JsonSax::CheckDepthLimit() const |
| 539 | { |
| 540 | if (m_Stack.size() >= m_DepthLimit) { |
| 541 | std::ostringstream buf; |
| 542 | buf << "JSON decoding recursion limit reached (path: root"; |
| 543 | for (const auto& node : m_Stack) { |
| 544 | buf << "["; |
| 545 | if (node.m_Dictionary) { |
| 546 | buf << JsonEncode(node.m_CurrentKey); |
| 547 | } else { |
| 548 | buf << node.m_Array->GetLength() - 1; |
| 549 | } |
| 550 | buf << "]"; |
| 551 | } |
| 552 | buf << ")"; |
| 553 | BOOST_THROW_EXCEPTION(std::runtime_error(buf.str())); |
| 554 | } |
| 555 | } |