-
Notifications
You must be signed in to change notification settings - Fork 3.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
Validate the end of input when parsing JSON #10783
Conversation
fixes #10724 |
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.
assertFails("SELECT JSON '{}{abc'") | ||
.hasErrorCode(INVALID_LITERAL); | ||
assertFails("SELECT JSON '{}abc'") | ||
.hasErrorCode(INVALID_LITERAL); |
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.
let's have tests with json_parse
invocation too
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.
added
eaa2d56
to
3ade9c2
Compare
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.
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>
fixes #10724