summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@askmonty.org>2020-10-22 15:51:14 +0400
committerAlexey Botchkov <holyfoot@askmonty.org>2020-10-22 15:51:14 +0400
commit21ea14db8cc8c5d88ff804650de7caf984d08a98 (patch)
treec8f021d2bf090d6eba9b4bbdfc3f9f322d26de6b /mysql-test
parent620ea816adeceaba7c875679ab8505f4c07a22b8 (diff)
downloadmariadb-git-21ea14db8cc8c5d88ff804650de7caf984d08a98.tar.gz
MDEV-20593 SIGSEGV in report_json_error_ex (on optimized builds).
When first argument to the JSON_MERGE_PATCH was NULL and second - the invalid JSON line, the error code was garbage. So it should be set to 0 initially.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/func_json.result5
-rw-r--r--mysql-test/t/func_json.test1
2 files changed, 6 insertions, 0 deletions
diff --git a/mysql-test/r/func_json.result b/mysql-test/r/func_json.result
index caf46eb5145..8f014c89733 100644
--- a/mysql-test/r/func_json.result
+++ b/mysql-test/r/func_json.result
@@ -898,6 +898,11 @@ NULL
SELECT JSON_MERGE_PATCH(NULL, '[1,2,3]');
JSON_MERGE_PATCH(NULL, '[1,2,3]')
[1, 2, 3]
+SELECT JSON_MERGE_PATCH(NULL, 'a');
+JSON_MERGE_PATCH(NULL, 'a')
+NULL
+Warnings:
+Warning 4038 Syntax error in JSON text in argument 2 to function 'json_merge_patch' at position 1
SELECT JSON_MERGE_PATCH('{"a":"b"}', NULL, '[1,2,3]', '{"c":null,"d":"e"}');
JSON_MERGE_PATCH('{"a":"b"}', NULL, '[1,2,3]', '{"c":null,"d":"e"}')
{"d": "e"}
diff --git a/mysql-test/t/func_json.test b/mysql-test/t/func_json.test
index c9adbd945b1..805e9954b81 100644
--- a/mysql-test/t/func_json.test
+++ b/mysql-test/t/func_json.test
@@ -531,6 +531,7 @@ DROP TABLE merge_t;
SELECT JSON_MERGE_PATCH('{"a":"b"}', NULL, '{"c":"d"}');
SELECT JSON_MERGE_PATCH(NULL, '[1,2,3]');
+SELECT JSON_MERGE_PATCH(NULL, 'a');
SELECT JSON_MERGE_PATCH('{"a":"b"}', NULL, '[1,2,3]', '{"c":null,"d":"e"}');
--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT