simdjson_php
simdjson_php copied to clipboard
simdjson_is_valid fails silently when json has depth exceeding 1024
With display_errors=stderr and error_reporting=E_ALL, there is still no reported error.
simdjson should probably check the error
result for errors specifically caused by recursion depth and emit a notice
php > var_export(simdjson_is_valid(str_repeat('[', 1000) . str_repeat(']', 1000)));
true
php > var_export(simdjson_is_valid(str_repeat('[', 1050) . str_repeat(']', 1050)));
false
- This should emit a warning or an error instead?
- The depth limit should be configurable
- Note that
struct open_container
in the simdjson implementation means that 8+1 bytes will be used for a given depth limit, so the alternative of setting depth tojson_length / 2
may (1) overflowsize_t
on 32-bit implementation, and (2) run out of memory