From 4ddcb4eb46c62cf459936554d43351db740ba14d Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Mon, 6 Aug 2018 13:37:09 +0400 Subject: MDEV-16750 JSON_SET mishandles unicode every second pair of arguments. The charset of temporary storage (Item_func_json_insert::tmp_js) was not properly set. --- sql/item_jsonfunc.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sql/item_jsonfunc.cc') diff --git a/sql/item_jsonfunc.cc b/sql/item_jsonfunc.cc index e9d38b78843..4a837646451 100644 --- a/sql/item_jsonfunc.cc +++ b/sql/item_jsonfunc.cc @@ -2384,8 +2384,9 @@ String *Item_func_json_insert::val_str(String *str) if ((null_value= args[0]->null_value)) return 0; - str->set_charset(js->charset()); - json_string_set_cs(&key_name, js->charset()); + str->set_charset(collation.collation); + tmp_js.set_charset(collation.collation); + json_string_set_cs(&key_name, collation.collation); for (n_arg=1, n_path=0; n_arg < arg_count; n_arg+=2, n_path++) { @@ -2599,7 +2600,6 @@ continue_point: json_scan_start(&je, js->charset(),(const uchar *) js->ptr(), (const uchar *) js->ptr() + js->length()); str->length(0); - str->set_charset(js->charset()); if (json_nice(&je, str, Item_func_json_format::LOOSE)) goto js_error; -- cgit v1.2.1