-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disallow invalid escape sequences in JSON.parse
#66170
Disallow invalid escape sequences in JSON.parse
#66170
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay reviewing.
Seems fine to me, though this probably needs testing to ensure that it won't break user expectations somewhat. A bit late for this in the 4.1 release cycle so let's merge for 4.2 early on.
Could be good to add more unit tests to validate this behavior.
db9765f
to
cb0be11
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
cb0be11
to
c1b7747
Compare
c1b7747
to
427b293
Compare
Thanks! |
Part of #66114
According to the JSON specs, following is the definition of a character:
So any unlisted backslash escape will now cause a parsing error, instead of being silently accepted.
Add unit tests to ensure this behavior.