• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //     __ _____ _____ _____
2 //  __|  |   __|     |   | |  JSON for Modern C++ (supporting code)
3 // |  |  |__   |  |  | | | |  version 3.11.2
4 // |_____|_____|_____|_|___|  https://github.com/nlohmann/json
5 //
6 // SPDX-FileCopyrightText: 2013-2022 Niels Lohmann <https://nlohmann.me>
7 // SPDX-License-Identifier: MIT
8 
9 #include "doctest_compatibility.h"
10 
11 #include <nlohmann/json.hpp>
12 using nlohmann::json;
13 
14 #include <algorithm>
15 
16 TEST_CASE("tests on very large JSONs")
17 {
18     SECTION("issue #1419 - Segmentation fault (stack overflow) due to unbounded recursion")
19     {
20         const auto depth = 5000000;
21 
22         std::string s(static_cast<std::size_t>(2 * depth), '[');
23         std::fill(s.begin() + depth, s.end(), ']');
24 
25         json _;
26         CHECK_NOTHROW(_ = nlohmann::json::parse(s));
27     }
28 }
29 
30