1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-11562 Assertion `js->state == JST_VALUE' failed in check_contains(json_engine_t*, json_engine_t*).

check_contains() fixed. When an item of an array is a complex
        structure, it can be half-read after the end of the recursive
        check_contains() call. So we just manually get to it's ending.
This commit is contained in:
Alexey Botchkov
2016-12-16 12:32:56 +04:00
parent 8938031bc7
commit e5377be211
5 changed files with 36 additions and 24 deletions

View File

@ -1158,25 +1158,12 @@ int json_path_setup(json_path_t *p,
}
int json_skip_level(json_engine_t *j)
int json_skip_to_level(json_engine_t *j, json_level_t level)
{
int ct= 0;
while (json_scan_next(j) == 0)
{
switch (j->state) {
case JST_OBJ_START:
case JST_ARRAY_START:
ct++;
break;
case JST_OBJ_END:
case JST_ARRAY_END:
if (ct == 0)
return 0;
ct--;
break;
}
}
do {
if (j->stack_p < level)
return 0;
} while (json_scan_next(j) == 0);
return 1;
}