Open Beefster09 opened 1 year ago
Confirmed on Windows 10. It also occurs with a Scratch size of 48 MiB, no longer occurs at 64 MiB.
It's important to note that the exact result of the corruption varies. Most of the time, it results in a segfault, but occasionally it results in a buffer overrun where damn near everything in memory gets printed. It's possible that increasing scratch memory size only masked the really bad stuff from happening and it would happen again with a larger (perhaps 32 items, such that it triggers another reallocation) json array.
Context
Expected Behavior
There should be no memory corruption / segfault
Current Behavior
Certain json inputs of long arrays of objects result in corrupted memory and segfaults when using the scratch allocator
Failure Information (for bugs)
This memory corruption does not occur with other temporary allocators. My program no longer crashed upon switching from a scratch allocator to an arena allocator.
More than likely this is an issue with the allocator rather than the json parser, however json parsing was what surfaced the bug, so there may be an issue with json parsing as well.
The threshold seems to be json arrays of 16 json objects or more (presumably this triggers a reallocation of the Array)
Steps to Reproduce
Minimal program to reproduce:
Failure Logs
output of above program: