summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@askmonty.org>2016-12-24 10:51:43 +0400
committerAlexey Botchkov <holyfoot@askmonty.org>2016-12-24 10:51:43 +0400
commit4d10273b4fd4e4fa8c479bf23afdd0d01cb3b0b5 (patch)
treee3b18c85f03239cee0cdc5dadc6060f6439da9c9 /strings
parentbbb3fb318ebeec4c5e5e932d9b20bd86def753e5 (diff)
downloadmariadb-git-4d10273b4fd4e4fa8c479bf23afdd0d01cb3b0b5.tar.gz
MDEV-11571 JSON_EXTRACT returns wrong results.
Array counter didn't increment after an item was found.
Diffstat (limited to 'strings')
-rw-r--r--strings/json_lib.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/strings/json_lib.c b/strings/json_lib.c
index a93200cd4dd..47a3e37fa4c 100644
--- a/strings/json_lib.c
+++ b/strings/json_lib.c
@@ -1270,7 +1270,7 @@ int json_find_path(json_engine_t *je,
case JST_VALUE:
DBUG_ASSERT(cur_step->type & JSON_PATH_ARRAY);
if (cur_step->type & JSON_PATH_WILD ||
- cur_step->n_item == array_counters[cur_step - p->steps])
+ cur_step->n_item == array_counters[cur_step - p->steps]++)
{
/* Array item matches. */
if (cur_step == p->last_step ||
@@ -1278,10 +1278,7 @@ int json_find_path(json_engine_t *je,
goto exit;
}
else
- {
json_skip_array_item(je);
- array_counters[cur_step - p->steps]++;
- }
break;
case JST_OBJ_END:
case JST_ARRAY_END: