Open sugawarayuuta opened 9 months ago
IIRC, the v1 code has logic to handle this in the simple case of a pointer being a reference to itself, but fails for the more general case of a cyclic pointer somewhere in the tree.
We should fix this in v2, but should fix the general case, but not the one-off special case. However, since this arises very rarely in practice (and isn't a security flaw since a malicious JSON input can't produce a cyclic pointer situation), the fix should ideally be low cost in memory and CPU.
Speaking of correctness, I found an issue regarding recursive structure in various json libraries. consider this example:
while this is a minor bug, it's better to not have stackoverflows than having it. What do you think about adding an extra error to these libraries to prevent this?