summaryrefslogtreecommitdiff
path: root/sql/item_jsonfunc.cc
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@askmonty.org>2017-09-12 11:20:30 +0400
committerAlexey Botchkov <holyfoot@askmonty.org>2017-09-12 11:20:30 +0400
commit6352ec2184dc8e5744aed3f718fc635edb4b511f (patch)
tree384d91f8b9745139274528db590fc01538726759 /sql/item_jsonfunc.cc
parent31774f0ede81d77d889061324930d3d0066c653a (diff)
downloadmariadb-git-6352ec2184dc8e5744aed3f718fc635edb4b511f.tar.gz
MDEV-12982 JSON_EXTRACT returns data for invalid JSON.
Let's check the validity to the end of the JSON.
Diffstat (limited to 'sql/item_jsonfunc.cc')
-rw-r--r--sql/item_jsonfunc.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/sql/item_jsonfunc.cc b/sql/item_jsonfunc.cc
index c2a9ca28c99..c30ce45bfb2 100644
--- a/sql/item_jsonfunc.cc
+++ b/sql/item_jsonfunc.cc
@@ -821,7 +821,11 @@ String *Item_func_json_extract::read_json(String *str,
not_first_value= 1;
if (!possible_multiple_values)
+ {
+ /* Loop to the end of the JSON just to make sure it's valid. */
+ while (json_get_path_next(&je, &p) == 0) {}
break;
+ }
}
if (je.s.error)