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 /include | |
| 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 'include')
| -rw-r--r-- | include/toml++/impl/preprocessor.hpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/include/toml++/impl/preprocessor.hpp b/include/toml++/impl/preprocessor.hpp index ff2ce6dd23..d74d2b616c 100644 --- a/include/toml++/impl/preprocessor.hpp +++ b/include/toml++/impl/preprocessor.hpp @@ -1177,9 +1177,11 @@ #endif #ifndef TOML_MAX_NESTED_VALUES -#define TOML_MAX_NESTED_VALUES 256 +#define TOML_MAX_NESTED_VALUES 128 // this refers to the depth of nested values, e.g. inline tables and arrays. -// 256 is crazy high! if you're hitting this limit with real input, TOML is probably the wrong tool for the job... +// 128 is very generous; real TOML files rarely exceed single-digit nesting. +// keep this value low enough to avoid stack overflows in sanitizer-instrumented builds +// where each recursion cycle may consume ~3KB of stack. #endif #ifndef TOML_MAX_DOTTED_KEYS_DEPTH |
