summaryrefslogtreecommitdiff
path: root/mysql-test/r/func_des_encrypt.result
diff options
context:
space:
mode:
authorGeorgi Kodinov <joro@sun.com>2009-04-17 18:52:57 +0300
committerGeorgi Kodinov <joro@sun.com>2009-04-17 18:52:57 +0300
commit08044795697dfd588841f9bacf589a4eeeff2431 (patch)
tree1a103f41199af1702db6e3d6d01f1ada092c387d /mysql-test/r/func_des_encrypt.result
parentff923cc82d23f9806834a2411150e32d30b9f4d9 (diff)
downloadmariadb-git-08044795697dfd588841f9bacf589a4eeeff2431.tar.gz
Bug #35087: Inserting duplicate values at one time with DES_ENCRYPT leads
to wrong results 3 problems found with DES_ENCRYPT/DES_DECRYPT : 1. The max length was not calculated properly. Fixed in fix_length_and_dec() 2. DES_ENCRYPT had a side effect of sometimes reallocating and changing the value of its argument. Fixed by explicitly pre-allocating the necessary space to pad the argument with trailing '*' (stars) when calculating the DES digest. 3. in DES_ENCRYPT the string buffer for the result value was not reallocated to the correct size and only string length was assigned to it. Fixed by making sure there's enough space to hold the result.
Diffstat (limited to 'mysql-test/r/func_des_encrypt.result')
-rw-r--r--mysql-test/r/func_des_encrypt.result34
1 files changed, 34 insertions, 0 deletions
diff --git a/mysql-test/r/func_des_encrypt.result b/mysql-test/r/func_des_encrypt.result
index 46b30bdab58..b81f96f6ef7 100644
--- a/mysql-test/r/func_des_encrypt.result
+++ b/mysql-test/r/func_des_encrypt.result
@@ -1,3 +1,37 @@
select des_encrypt('hello');
des_encrypt('hello')
€Ö2nV“Ø}
+#
+# Bug #11643: des_encrypt() causes server to die
+#
+CREATE TABLE t1 (des VARBINARY(200) NOT NULL DEFAULT '') ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('1234'), ('12345'), ('123456'), ('1234567');
+UPDATE t1 SET des=DES_ENCRYPT('1234');
+SELECT LENGTH(des) FROM t1;
+LENGTH(des)
+9
+9
+9
+9
+SELECT DES_DECRYPT(des) FROM t1;
+DES_DECRYPT(des)
+1234
+1234
+1234
+1234
+SELECT
+LENGTH(DES_ENCRYPT('1234')),
+LENGTH(DES_ENCRYPT('12345')),
+LENGTH(DES_ENCRYPT('123456')),
+LENGTH(DES_ENCRYPT('1234567'));
+LENGTH(DES_ENCRYPT('1234')) LENGTH(DES_ENCRYPT('12345')) LENGTH(DES_ENCRYPT('123456')) LENGTH(DES_ENCRYPT('1234567'))
+9 9 9 9
+SELECT
+DES_DECRYPT(DES_ENCRYPT('1234')),
+DES_DECRYPT(DES_ENCRYPT('12345')),
+DES_DECRYPT(DES_ENCRYPT('123456')),
+DES_DECRYPT(DES_ENCRYPT('1234567'));
+DES_DECRYPT(DES_ENCRYPT('1234')) DES_DECRYPT(DES_ENCRYPT('12345')) DES_DECRYPT(DES_ENCRYPT('123456')) DES_DECRYPT(DES_ENCRYPT('1234567'))
+1234 12345 123456 1234567
+DROP TABLE t1;
+End of 5.0 tests