Skip to content

Commit b290ef8

Browse files
author
Alexey Botchkov
committed
MDEV-17454 JSON_VALID( '{"a":1]' ) evaluates to 1.
Produce syntax error when '{...]'.
1 parent a12b8ac commit b290ef8

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

mysql-test/r/func_json.result

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -824,3 +824,9 @@ t2 CREATE TABLE `t2` (
824824
) ENGINE=MyISAM DEFAULT CHARSET=latin1
825825
DROP TABLE t1, t2;
826826
SET sql_mode=default;
827+
#
828+
# MDEV-17454 JSON_VALID( '{"a":1]' ) evaluates to 1
829+
#
830+
select JSON_VALID( '{"a":1]' );
831+
JSON_VALID( '{"a":1]' )
832+
0

mysql-test/t/func_json.test

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,3 +481,9 @@ SHOW CREATE TABLE t2;
481481
DROP TABLE t1, t2;
482482
SET sql_mode=default;
483483

484+
--echo #
485+
--echo # MDEV-17454 JSON_VALID( '{"a":1]' ) evaluates to 1
486+
--echo #
487+
488+
select JSON_VALID( '{"a":1]' );
489+

strings/json_lib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,7 @@ static json_state_handler json_actions[NR_JSON_STATES][NR_C_CLASSES]=
774774
syntax_error, syntax_error, syntax_error, syntax_error, syntax_error,
775775
syntax_error, syntax_error, syntax_error, not_json_chr, bad_chr},
776776
{/*OBJ_CONT*/
777-
unexpected_eos, syntax_error, end_object, syntax_error, end_array,
777+
unexpected_eos, syntax_error, end_object, syntax_error, syntax_error,
778778
syntax_error, next_key, syntax_error, syntax_error, syntax_error,
779779
syntax_error, syntax_error, syntax_error, not_json_chr, bad_chr},
780780
{/*ARRAY_CONT*/

0 commit comments

Comments
 (0)