Commit 6ac2a355 authored by Alexey Botchkov's avatar Alexey Botchkov

MDEV-19628 JSON with starting double quotes key is not valid.

First character of the key name is just skipped, so the escapement
wasn't handled properly.
parent 2911a9a6
......@@ -951,5 +951,17 @@ SELECT json_valid('{"test": "\\ud83d\\ude0b"}');
json_valid('{"test": "\\ud83d\\ude0b"}')
1
#
# MDEV-19670 json escaped unicode parse error
#
SELECT JSON_VALID('{"admin\\"": null}'), '{"admin\\"": null}'
UNION
SELECT JSON_VALID('{"\\"admin": null}'), '{"\\"admin": null}'
UNION
SELECT JSON_VALID('{"\\"": null}'), '{"\\"": null}';
JSON_VALID('{"admin\\"": null}') {"admin\"": null}
1 {"admin\"": null}
1 {"\"admin": null}
1 {"\"": null}
#
# End of 10.3 tests
#
......@@ -568,6 +568,16 @@ SELECT
SELECT json_valid('{"value":"\\ud83d\\ude0a"}');
SELECT json_valid('{"test": "\\ud83d\\ude0b"}');
--echo #
--echo # MDEV-19670 json escaped unicode parse error
--echo #
SELECT JSON_VALID('{"admin\\"": null}'), '{"admin\\"": null}'
UNION
SELECT JSON_VALID('{"\\"admin": null}'), '{"\\"admin": null}'
UNION
SELECT JSON_VALID('{"\\"": null}'), '{"\\"": null}';
--echo #
--echo # End of 10.3 tests
--echo #
......@@ -825,6 +825,8 @@ static int skip_colon(json_engine_t *j)
static int skip_key(json_engine_t *j)
{
int t_next, c_len;
j->s.c_str-= j->sav_c_len;
while (json_read_keyname_chr(j) == 0) {}
if (j->s.error)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment