From 6352ec2184dc8e5744aed3f718fc635edb4b511f Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Tue, 12 Sep 2017 11:20:30 +0400 Subject: MDEV-12982 JSON_EXTRACT returns data for invalid JSON. Let's check the validity to the end of the JSON. --- sql/item_jsonfunc.cc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'sql/item_jsonfunc.cc') 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) -- cgit v1.2.1