Skip to content

Commit 93b6310

Browse files
nielsdosjorgsowa
authored andcommitted
Fix phpGH-15168: stack overflow in json_encode()
The JSON encoder is recursive, and it's far from easy to make it iterative. Add a cheap stack limit check to prevent a segfault. This uses the PHP_JSON_ERROR_DEPTH error code that already talks about the stack depth. Previously this was only used for the $depth argument. Closes phpGH-16059.
1 parent 0236f0e commit 93b6310

File tree

3 files changed

+1234
-16
lines changed

3 files changed

+1234
-16
lines changed

0 commit comments

Comments
 (0)