Skip to content

Validate the end of input when parsing JSON #17377

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

v-jizhang
Copy link
Contributor

Cherry-pick of trinodb/trino#10783

Before this change, the end of input after reading a JSON value
was not properly validated:

  • if there were remaining characters which did not parse as JSON,
    exception was thrown. E.g. '["correct JSON"]and more' failed
  • if there were remaining characters which formed a valid token,
    they were silently ignored. E.g. '["correct JSON"]{and more'
    succeeded and returned '["correct JSON"]'

After this change, any trailing characters are caught and reported
as error.

Co-authored-by: kasiafi [email protected]

Test plan - Added tests

== RELEASE NOTES ==

General Changes
* Validate the end of input when parsing JSON

Cherry-pick of trinodb/trino#10783

Before this change, the end of input after reading a JSON value
was not properly validated:
- if there were remaining characters which did not parse as JSON,
  exception was thrown. E.g. `'["correct JSON"]and more'` failed
- if there were remaining characters which formed a valid token,
  they were silently ignored. E.g. `'["correct JSON"]{and more'`
  succeeded and returned `'["correct JSON"]'`

After this change, any trailing characters are caught and reported
as error.

Co-authored-by: kasiafi <[email protected]>
@stale
Copy link

stale bot commented Sep 21, 2022

This pull request has been automatically marked as stale because it has not had recent activity. If you'd still like this PR merged, please comment on the task, make sure you've addressed reviewer comments, and rebase on the latest master. Thank you for your contributions!

@stale stale bot added the stale label Sep 21, 2022
@wanglinsong wanglinsong requested review from jaystarshot, feilong-liu and a team as code owners July 6, 2024 04:32
@wanglinsong wanglinsong requested a review from presto-oss July 6, 2024 04:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant