MDEV-12351 Assertion `cur_step->type & JSON_PATH_KEY' failed in

json_find_path.

        The ..[0] path can be treated wrong on second json_find_path
        call.
This commit is contained in:
Alexey Botchkov 2017-05-02 15:16:01 +04:00
commit 4a484e7a20
3 changed files with 10 additions and 0 deletions

View file

@ -633,3 +633,6 @@ SET @str = 'bar', @path = '$';
SELECT JSON_SEARCH('{"foo":"bar"}', 'all' , @str, '%', @path);
JSON_SEARCH('{"foo":"bar"}', 'all' , @str, '%', @path)
"$.foo"
SELECT JSON_VALUE('[{"foo": 1},"bar"]', '$[*][0]');
JSON_VALUE('[{"foo": 1},"bar"]', '$[*][0]')
bar

View file

@ -281,3 +281,9 @@ drop table t1;
SET @str = 'bar', @path = '$';
SELECT JSON_SEARCH('{"foo":"bar"}', 'all' , @str, '%', @path);
#
# MDEV-12351 Assertion `cur_step->type & JSON_PATH_KEY' failed in json_find_path.
#
SELECT JSON_VALUE('[{"foo": 1},"bar"]', '$[*][0]');

View file

@ -1248,6 +1248,7 @@ static int handle_match(json_engine_t *je, json_path_t *p,
if (++next_step > p->last_step)
{
je->s.c_str= je->value_begin;
je->stack_p--;
return 1;
}
} while (next_step->type == JSON_PATH_ARRAY && next_step->n_item == 0);