Open devinus opened 3 months ago
Hey @devinus,
Thank you for mentioning the new RFC and its requirements.
I have rewritten the JSON parser for the https://github.com/quickjs-ng/quickjs friendly fork. I shall merge this into this repository as well, once it is finalized there. The new parser is much stricter (to my dismay) and should be fully conformant, except for the excessive depth case. I will consider switching to a non recursive parser using an allocated stack to get rid of the nesting limit.
Regarding the JSON spec, I cannot help but mention my personal rant about this format:
Infinity
and NaN
as numeric values is ridiculous and leads to cumbersome workarounds using strings..1
and 1.
?
Right now the JSON parser has an unconfigurable maximum nesting depth and will fail on input such as this with the unfriendly exception
SyntaxError: stack overflow
when trying to parse a JSON object that's too deeply nested.Consider making the parser ECMA 404 compliant by either 1) allowing infinite nesting, 2) a configurable nesting depth, or 3) documentation about the default maximum nesting depth (I'm assuming this is currently architecture specific).