Bug #44365 valgrind warnings with encrypt() function
Submitted: 20 Apr 2009 15:12 Modified: 12 May 2009 2:47
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: General Severity:S3 (Non-critical)
Version:5.0.91,5.1.35 OS:Linux
Assigned to: Sergei Glukhov CPU Architecture:Any
Tags: encrypt, valgrind

[20 Apr 2009 15:12] Shane Bester
Description:
running mysqld under valgrind shows many warnings about:
Conditional jump or move depends on uninitialised value(s)

in the functions:
String::c_ptr() (sql_string.h:102)
Item_func_encrypt::val_str(String*) (sql_string.h:102)
strncpy (mc_replace_strmem.c:291)

See file attachment for full output.

How to repeat:
drop table if exists test;
create table `test` (`col30` smallint(6) default null,`col45` 
mediumtext character set utf8) engine=myisam default charset=latin1;
insert into `test` values (null,'contraction\'s');
insert into `test` values (-15818,'requirement\'s');
explain extended select encrypt(col30,col45) as a from test,(select encrypt(col30,col45) as b from test) a ;
select encrypt(col30,col45) as a from test,(select encrypt(col30,col45) as b from test) a ;
select encrypt(col30,col45) as a from test,(select encrypt(col30,col45) as b from test) a order by a ;
[20 Apr 2009 15:13] MySQL Verification Team
valgrind outputs

Attachment: bug44365_valgrind_output_5.1.35.txt (text/plain), 6.29 KiB.

[21 Apr 2009 8:46] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/72547

2862 Sergey Glukhov	2009-04-21
      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()
[23 Apr 2009 8:48] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/72698

2865 Sergey Glukhov	2009-04-23
      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()
[5 May 2009 19:40] Bugs System
Pushed into 5.1.35 (revid:davi.arnaut@sun.com-20090505190206-9xmh7dlc6kom8exp) (version source revid:davi.arnaut@sun.com-20090505190206-9xmh7dlc6kom8exp) (merge vers: 5.1.35) (pib:6)
[6 May 2009 14:10] Bugs System
Pushed into 6.0.12-alpha (revid:svoj@sun.com-20090506125450-yokcmvqf2g7jhujq) (version source revid:sergey.glukhov@sun.com-20090423084237-j570b1umgk6tb4ha) (merge vers: 6.0.11-alpha) (pib:6)
[12 May 2009 2:47] Paul DuBois
Noted in 5.1.35, 6.0.12 changelogs.

Valgrind warnings for the DECODE(), ENCRYPT(), and FIND_IN_SET()
functions were corrected.
[15 Jun 2009 8:27] Bugs System
Pushed into 5.1.35-ndb-6.3.26 (revid:jonas@mysql.com-20090615074202-0r5r2jmi83tww6sf) (version source revid:jonas@mysql.com-20090615070837-9pccutgc7repvb4d) (merge vers: 5.1.35-ndb-6.3.26) (pib:6)
[15 Jun 2009 9:06] Bugs System
Pushed into 5.1.35-ndb-7.0.7 (revid:jonas@mysql.com-20090615074335-9hcltksp5cu5fucn) (version source revid:jonas@mysql.com-20090615072714-rmfkvrbbipd9r32c) (merge vers: 5.1.35-ndb-7.0.7) (pib:6)
[15 Jun 2009 9:47] Bugs System
Pushed into 5.1.35-ndb-6.2.19 (revid:jonas@mysql.com-20090615061520-sq7ds4yw299ggugm) (version source revid:jonas@mysql.com-20090615054654-ebgpz7elwu1xj36j) (merge vers: 5.1.35-ndb-6.2.19) (pib:6)
[15 Oct 2010 6:37] MySQL Verification Team
this bug still hits 5.0.91 in random tests.

Conditional jump or move depends on uninitialised value(s)
at: Item_func_encrypt::val_str (sql_string.h:101)
by: Item::send (item.cc:5144)
by: select_send::send_data (sql_class.cc:1072)
by: JOIN::exec (sql_select.cc:1674)
by: mysql_select (sql_select.cc:2366)
by: handle_select (sql_select.cc:257)
by: mysql_execute_command (sql_parse.cc:2921)
by: mysql_parse (sql_parse.cc:6470)
by: dispatch_command (sql_parse.cc:1966)
by: handle_one_connection (sql_parse.cc:1647)
by: start_thread (pthread_create.c:301)