Skip to content

Commit

Permalink
MDEV-12351 Assertion `cur_step->type & JSON_PATH_KEY' failed in
Browse files Browse the repository at this point in the history
json_find_path.

        The ..[0] path can be treated wrong on second json_find_path
        call.
  • Loading branch information
Alexey Botchkov committed May 2, 2017
1 parent 42ad4f2 commit 4a484e7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions mysql-test/r/func_json.result
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 6 additions & 0 deletions mysql-test/t/func_json.test
Original file line number Diff line number Diff line change
Expand Up @@ -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]');

1 change: 1 addition & 0 deletions strings/json_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 4a484e7

Please sign in to comment.