Skip to content

Validate the end of input when parsing JSON#17377

Open
v-jizhang wants to merge 1 commit intoprestodb:masterfrom
v-jizhang:json-validate-end
Open

Validate the end of input when parsing JSON#17377
v-jizhang wants to merge 1 commit intoprestodb:masterfrom
v-jizhang:json-validate-end

Conversation

@v-jizhang
Copy link
Copy Markdown
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 30203062+kasiafi@users.noreply.github.com

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 <30203062+kasiafi@users.noreply.github.com>
@stale
Copy link
Copy Markdown

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 a team, feilong-liu and jaystarshot 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