[Commits] b290ef8: MDEV-17454 JSON_VALID( '{"a":1]' ) evaluates to 1.
revision-id: b290ef8c76e2d7dfbae7a85766694a6fd4648eac (mariadb-10.2.18-73-gb290ef8) parent(s): a12b8ac8e9636f8258bcb17a0845b9317d870fd9 committer: Alexey Botchkov timestamp: 2018-11-12 01:50:07 +0400 message: MDEV-17454 JSON_VALID( '{"a":1]' ) evaluates to 1. Produce syntax error when '{...]'. --- mysql-test/r/func_json.result | 6 ++++++ mysql-test/t/func_json.test | 6 ++++++ strings/json_lib.c | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/func_json.result b/mysql-test/r/func_json.result index 90458bc..74798b1 100644 --- a/mysql-test/r/func_json.result +++ b/mysql-test/r/func_json.result @@ -824,3 +824,9 @@ t2 CREATE TABLE `t2` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1, t2; SET sql_mode=default; +# +# MDEV-17454 JSON_VALID( '{"a":1]' ) evaluates to 1 +# +select JSON_VALID( '{"a":1]' ); +JSON_VALID( '{"a":1]' ) +0 diff --git a/mysql-test/t/func_json.test b/mysql-test/t/func_json.test index d266641..43bd198 100644 --- a/mysql-test/t/func_json.test +++ b/mysql-test/t/func_json.test @@ -481,3 +481,9 @@ SHOW CREATE TABLE t2; DROP TABLE t1, t2; SET sql_mode=default; +--echo # +--echo # MDEV-17454 JSON_VALID( '{"a":1]' ) evaluates to 1 +--echo # + +select JSON_VALID( '{"a":1]' ); + diff --git a/strings/json_lib.c b/strings/json_lib.c index 4f12cbb..394517a 100644 --- a/strings/json_lib.c +++ b/strings/json_lib.c @@ -774,7 +774,7 @@ static json_state_handler json_actions[NR_JSON_STATES][NR_C_CLASSES]= syntax_error, syntax_error, syntax_error, syntax_error, syntax_error, syntax_error, syntax_error, syntax_error, not_json_chr, bad_chr}, {/*OBJ_CONT*/ - unexpected_eos, syntax_error, end_object, syntax_error, end_array, + unexpected_eos, syntax_error, end_object, syntax_error, syntax_error, syntax_error, next_key, syntax_error, syntax_error, syntax_error, syntax_error, syntax_error, syntax_error, not_json_chr, bad_chr}, {/*ARRAY_CONT*/
participants (1)
-
holyfoot@askmonty.org