summaryrefslogtreecommitdiff
path: root/mysql-test/t/func_time.test
diff options
context:
space:
mode:
authortnurnberg@salvation.intern.azundris.com <>2006-09-04 09:13:40 +0200
committertnurnberg@salvation.intern.azundris.com <>2006-09-04 09:13:40 +0200
commit13200c3f9616cc10d1d077799f4d9945693350bc (patch)
treec7039cec08667391b6eac2780670c33d5b05f669 /mysql-test/t/func_time.test
parent635281619b73801417cec034f46a31d09cbbd298 (diff)
downloadmariadb-git-13200c3f9616cc10d1d077799f4d9945693350bc.tar.gz
Bug#21913: DATE_FORMAT() Crashes mysql server if I use it through mysql-connector-j driver.
Variable character_set_results can legally be NULL (for "no conversion.") This could result in a NULL deref that crashed the server. Fixed. (Although ran some additional precursory tests to see whether I could break anything else, but no breakage so far.)
Diffstat (limited to 'mysql-test/t/func_time.test')
-rw-r--r--mysql-test/t/func_time.test18
1 files changed, 18 insertions, 0 deletions
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
index b232fb14e1e..8a7f8792081 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -358,4 +358,22 @@ create table t1 select now() - now(), curtime() - curtime(),
show create table t1;
drop table t1;
+#
+# 21913: DATE_FORMAT() Crashes mysql server if I use it through
+# mysql-connector-j driver.
+#
+
+SET NAMES latin1;
+SET character_set_results = NULL;
+SHOW VARIABLES LIKE 'character_set_results';
+
+CREATE TABLE testBug8868 (field1 DATE, field2 VARCHAR(32) CHARACTER SET BINARY);
+INSERT INTO testBug8868 VALUES ('2006-09-04', 'abcd');
+
+SELECT DATE_FORMAT(field1,'%b-%e %l:%i%p') as fmtddate, field2 FROM testBug8868;
+
+DROP TABLE testBug8868;
+
+SET NAMES DEFAULT;
+
# End of 4.1 tests