summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@askmonty.org>2016-12-16 12:32:56 +0400
committerAlexey Botchkov <holyfoot@askmonty.org>2016-12-16 12:32:56 +0400
commite5377be211692e3f2a6f2add24dcb83f316f8154 (patch)
tree4e493d47467cfb3fb353c89a70098a8eecbf258a /strings
parent8938031bc7eb78d406553465341338038cfb2e1a (diff)
downloadmariadb-git-e5377be211692e3f2a6f2add24dcb83f316f8154.tar.gz
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.
Diffstat (limited to 'strings')
-rw-r--r--strings/json_lib.c23
1 files changed, 5 insertions, 18 deletions
diff --git a/strings/json_lib.c b/strings/json_lib.c
index acca7eb0739..a93200cd4dd 100644
--- a/strings/json_lib.c
+++ b/strings/json_lib.c
@@ -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;
}