Bug#44365 valgrind warnings with encrypt() function
replaced String->c_ptr() with String->c_ptr_safe() mysql-test/r/func_encrypt.result: test result mysql-test/t/func_encrypt.test: test case sql/item_strfunc.cc: replaced String->c_ptr() with String->c_ptr_safe()
This commit is contained in:
parent
5f9e40a5f8
commit
9bd3ef2ebb
@ -183,3 +183,15 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select des_decrypt(des_encrypt('hello',4),'password2') AS `des_decrypt(des_encrypt("hello",4),'password2')`,des_decrypt(des_encrypt('hello','hidden')) AS `des_decrypt(des_encrypt("hello","hidden"))`
|
Note 1003 select des_decrypt(des_encrypt('hello',4),'password2') AS `des_decrypt(des_encrypt("hello",4),'password2')`,des_decrypt(des_encrypt('hello','hidden')) AS `des_decrypt(des_encrypt("hello","hidden"))`
|
||||||
|
drop table if exists t1;
|
||||||
|
create table t1 (f1 smallint(6) default null, f2 mediumtext character set utf8)
|
||||||
|
engine=myisam default charset=latin1;
|
||||||
|
insert into t1 values (null,'contraction\'s');
|
||||||
|
insert into t1 values (-15818,'requirement\'s');
|
||||||
|
select encrypt(f1,f2) as a from t1,(select encrypt(f1,f2) as b from t1) a;
|
||||||
|
a
|
||||||
|
NULL
|
||||||
|
re3VF.eOzS/lg
|
||||||
|
NULL
|
||||||
|
re3VF.eOzS/lg
|
||||||
|
drop table t1;
|
||||||
|
@ -88,3 +88,16 @@ select hex(des_decrypt(des_encrypt("hello","hidden")));
|
|||||||
explain extended select des_decrypt(des_encrypt("hello",4),'password2'), des_decrypt(des_encrypt("hello","hidden"));
|
explain extended select des_decrypt(des_encrypt("hello",4),'password2'), des_decrypt(des_encrypt("hello","hidden"));
|
||||||
|
|
||||||
# End of 4.1 tests
|
# End of 4.1 tests
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug#44365 valgrind warnings with encrypt() function
|
||||||
|
#
|
||||||
|
--disable_warnings
|
||||||
|
drop table if exists t1;
|
||||||
|
--enable_warnings
|
||||||
|
create table t1 (f1 smallint(6) default null, f2 mediumtext character set utf8)
|
||||||
|
engine=myisam default charset=latin1;
|
||||||
|
insert into t1 values (null,'contraction\'s');
|
||||||
|
insert into t1 values (-15818,'requirement\'s');
|
||||||
|
select encrypt(f1,f2) as a from t1,(select encrypt(f1,f2) as b from t1) a;
|
||||||
|
drop table t1;
|
||||||
|
@ -1693,10 +1693,10 @@ String *Item_func_encrypt::val_str(String *str)
|
|||||||
String *salt_str=args[1]->val_str(&tmp_value);
|
String *salt_str=args[1]->val_str(&tmp_value);
|
||||||
if ((null_value= (args[1]->null_value || salt_str->length() < 2)))
|
if ((null_value= (args[1]->null_value || salt_str->length() < 2)))
|
||||||
return 0;
|
return 0;
|
||||||
salt_ptr= salt_str->c_ptr();
|
salt_ptr= salt_str->c_ptr_safe();
|
||||||
}
|
}
|
||||||
pthread_mutex_lock(&LOCK_crypt);
|
pthread_mutex_lock(&LOCK_crypt);
|
||||||
char *tmp= crypt(res->c_ptr(),salt_ptr);
|
char *tmp= crypt(res->c_ptr_safe(),salt_ptr);
|
||||||
if (!tmp)
|
if (!tmp)
|
||||||
{
|
{
|
||||||
pthread_mutex_unlock(&LOCK_crypt);
|
pthread_mutex_unlock(&LOCK_crypt);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user