summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@askmonty.org>2017-02-09 17:38:53 +0400
committerAlexey Botchkov <holyfoot@askmonty.org>2017-02-09 17:38:53 +0400
commit0e6968c2441769e912b1cf743b158f48206f933e (patch)
tree186e565488ebfc5a48f00f6ac4fa277438ebfb35 /strings
parent66c6188a4b21d81b8d882386e0b059c4a6d05224 (diff)
downloadmariadb-git-0e6968c2441769e912b1cf743b158f48206f933e.tar.gz
MDEV-11857 json_search() shows "Out of memory" with empty key.
We should be ready for an empty key.
Diffstat (limited to 'strings')
-rw-r--r--strings/json_lib.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/strings/json_lib.c b/strings/json_lib.c
index cc3a8adf0aa..213be62aa22 100644
--- a/strings/json_lib.c
+++ b/strings/json_lib.c
@@ -1701,8 +1701,10 @@ int json_get_path_next(json_engine_t *je, json_path_t *p)
{
case JST_KEY:
p->last_step->key= je->s.c_str;
- while (json_read_keyname_chr(je) == 0)
+ do
+ {
p->last_step->key_end= je->s.c_str;
+ } while (json_read_keyname_chr(je) == 0);
if (je->s.error)
return 1;
/* Now we have je.state == JST_VALUE, so let's handle it. */