1
0
mirror of https://github.com/nlohmann/json.git synced 2026-07-21 19:23:03 +04:00
Files
json/tests
Niels Lohmann 45c47ef921 Avoid deep recursion in serialization write-buffer test
The "many small structural writes exceed the write buffer" subcase built
a 1100-deep nested array and dumped it to force >1024 consecutive
single-character writes through put_char (exercising the write buffer's
flush-when-full branch). dump() recurses per nesting level, so on MSVC
debug builds (smaller default stack, larger frames) this overflowed the
stack and crashed test-serialization; Linux/macOS have enough headroom to
hide it.

Replace the nesting with a flat array of 500 empty strings. Each element
emits '"', '"', ',' via put_char, so the dump is a long run of
single-character writes (1501 bytes > the 1024-byte buffer) at nesting
depth two, hitting the same flush branch without deep recursion. Library
code is unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XAYM1qhSA2FDaDcGfPW3fG
Signed-off-by: Niels Lohmann <mail@nlohmann.me>
2026-07-21 07:27:08 +00:00
..
2026-01-01 20:00:39 +01:00
2026-01-01 20:00:39 +01:00
2026-01-01 20:00:39 +01:00
2026-01-01 20:00:39 +01:00
2026-01-01 20:00:39 +01:00
2026-01-01 20:00:39 +01:00
2022-05-01 09:41:50 +02:00
2025-05-31 17:48:34 +02:00
2022-05-09 08:02:41 +02:00
2022-05-01 09:41:50 +02:00