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
INSERT JSON without a JSON value crashes Scylla #14709
Comments
The reason is the same as in #14705, the parser shouldn't allow it. |
Fix: diff --git a/cql3/Cql.g b/cql3/Cql.g
index 9249c49cb..06f35423e 100644
--- a/cql3/Cql.g
+++ b/cql3/Cql.g
@@ -461,8 +461,7 @@ orderByClause[raw::select_statement::parameters::orderings_type& orderings]
;
jsonValue returns [expression value]
- :
- | s=STRING_LITERAL { $value = untyped_constant{untyped_constant::string, $s.text}; }
+ : s=STRING_LITERAL { $value = untyped_constant{untyped_constant::string, $s.text}; }
| m=marker { $value = std::move(m); }
; |
The fix for this would conflict with the one in #14707, let's wait for it to be merged first. |
cvybhu
added a commit
to cvybhu/scylladb
that referenced
this issue
Jul 21, 2023
We allow inserting column values using a JSON value, eg: ```cql INSERT INTO mytable JSON '{ "\"myKey\"": 0, "value": 0}'; ``` When no JSON value is specified, the query should be rejected. Currently Scylla crashes in such cases, let's fix this. This crashes Scylla: ```cql INSERT INTO mytable JSON; ``` A unit test is added to prevent regressions. Refs: scylladb#14707 Fixes: scylladb#14709 Signed-off-by: Jan Ciolek <jan.ciolek@scylladb.com>
cvybhu
added a commit
to cvybhu/scylladb
that referenced
this issue
Jul 21, 2023
We allow inserting column values using a JSON value, eg: ```cql INSERT INTO mytable JSON '{ "\"myKey\"": 0, "value": 0}'; ``` When no JSON value is specified, the query should be rejected. Scylla used to crash in such cases. A recent change fixed the crash (scylladb#14706), it now fails on unwrapping an uninitialized value, but really it should be rejected at the parsing stage, so let's fix the grammar so that it doesn't allow JSON queries without JSON values. A unit test is added to prevent regressions. Refs: scylladb#14707 Fixes: scylladb#14709 Signed-off-by: Jan Ciolek <jan.ciolek@scylladb.com>
patjed41
pushed a commit
to patjed41/scylladb
that referenced
this issue
Jul 27, 2023
We allow inserting column values using a JSON value, eg: ```cql INSERT INTO mytable JSON '{ "\"myKey\"": 0, "value": 0}'; ``` When no JSON value is specified, the query should be rejected. Scylla used to crash in such cases. A recent change fixed the crash (scylladb#14706), it now fails on unwrapping an uninitialized value, but really it should be rejected at the parsing stage, so let's fix the grammar so that it doesn't allow JSON queries without JSON values. A unit test is added to prevent regressions. Refs: scylladb#14707 Fixes: scylladb#14709 Signed-off-by: Jan Ciolek <jan.ciolek@scylladb.com> Closes scylladb#14785
avikivity
pushed a commit
that referenced
this issue
Sep 14, 2023
We allow inserting column values using a JSON value, eg: ```cql INSERT INTO mytable JSON '{ "\"myKey\"": 0, "value": 0}'; ``` When no JSON value is specified, the query should be rejected. Scylla used to crash in such cases. A recent change fixed the crash (#14706), it now fails on unwrapping an uninitialized value, but really it should be rejected at the parsing stage, so let's fix the grammar so that it doesn't allow JSON queries without JSON values. A unit test is added to prevent regressions. Refs: #14707 Fixes: #14709 Signed-off-by: Jan Ciolek <jan.ciolek@scylladb.com> \Closes #14785 (cherry picked from commit cbc97b4)
avikivity
pushed a commit
that referenced
this issue
Sep 14, 2023
We allow inserting column values using a JSON value, eg: ```cql INSERT INTO mytable JSON '{ "\"myKey\"": 0, "value": 0}'; ``` When no JSON value is specified, the query should be rejected. Scylla used to crash in such cases. A recent change fixed the crash (#14706), it now fails on unwrapping an uninitialized value, but really it should be rejected at the parsing stage, so let's fix the grammar so that it doesn't allow JSON queries without JSON values. A unit test is added to prevent regressions. Refs: #14707 Fixes: #14709 Signed-off-by: Jan Ciolek <jan.ciolek@scylladb.com> \Closes #14785 (cherry picked from commit cbc97b4)
Backported to 5.1, 5.2. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It's possible to do
INSERT INTO tab JSON
wihtout providing a valid JSON value:This crashes scylla.
Backtrace:
Scylla version (or git commit hash): Scylla 5.4.0~dev-0.20230714.033e5348aa82
The text was updated successfully, but these errors were encountered: