diff options
| author | danielbodorin <80352803+danielbodorin@users.noreply.github.com> | 2026-03-23 17:33:51 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-23 17:33:51 +0200 |
| commit | 1c8b7466e4946fcc3bf20484c0e1d001202cca5a (patch) | |
| tree | 4eda953d7aa7ad53475a3eb083c038fa0f232f20 /tests/user_feedback.cpp | |
| parent | 6626578220391cb1da6f79f9a4f12066c79f2d26 (diff) | |
| download | Project-Tick-1c8b7466e4946fcc3bf20484c0e1d001202cca5a.tar.gz Project-Tick-1c8b7466e4946fcc3bf20484c0e1d001202cca5a.zip | |
fix: lower TOML_MAX_NESTED_VALUES to prevent stack overflow on deeply nested arrays/inline tables (#293)
Co-authored-by: Daniel Bodorin <danielbodorin@users.noreply.github.com>
Diffstat (limited to 'tests/user_feedback.cpp')
| -rw-r--r-- | tests/user_feedback.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/user_feedback.cpp b/tests/user_feedback.cpp index 6cc1fd34c5..aa1f36b1d6 100644 --- a/tests/user_feedback.cpp +++ b/tests/user_feedback.cpp @@ -168,6 +168,18 @@ b = [] constexpr auto start = "fl =[ "sv; memcpy(s.data(), start.data(), start.length()); parsing_should_fail(FILE_LINE_ARGS, std::string_view{ s }); + + // deeply nested inline tables should also fail gracefully, not stack overflow + { + // build: fl = {a={a={a={a=...{a=1}...}}} + std::string nested_tables = "fl = "; + for (size_t i = 0; i < 2048; i++) + nested_tables += "{a="; + nested_tables += "1"; + for (size_t i = 0; i < 2048; i++) + nested_tables += "}"; + parsing_should_fail(FILE_LINE_ARGS, std::string_view{ nested_tables }); + } } SECTION("tomlplusplus/issues/112") // https://github.com/marzer/tomlplusplus/issues/112 |
