Bug #59125 valgrind uninitialised value warning in ull2dec, longlong2decimal
Submitted: 23 Dec 2010 11:23 Modified: 19 Apr 2011 16:36
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Data Types Severity:S3 (Non-critical)
Version:5.0.92,5.1.55,5.5.9,5.6.1 OS:Any
Assigned to: CPU Architecture:Any

[23 Dec 2010 11:23] Shane Bester
Description:
Version: '5.6.1-m5-valgrind-max-debug'  socket: '/tmp/mysql.sock'  port: 3306  Source distribution
Thread 18:
Conditional jump or move depends on uninitialised value(s)
at: ull2dec (decimal.c:998)
by: longlong2decimal (decimal.c:1026)
by: int2my_decimal (my_decimal.h:374)
by: Item_func::val_decimal( (item_func.cc:528)
by: Item_func_format::val_str_ascii (item_strfunc.cc:2397)
by: Item_str_ascii_func::val_str (item_strfunc.cc:77)
by: Item::send (item.cc:5931)
by: Protocol::send_result_set_row (protocol.cc:848)
by: select_send::send_data (sql_class.cc:1866)
by: JOIN::exec (sql_select.cc:2794)
by: mysql_select (sql_select.cc:3554)
by: handle_select (sql_select.cc:323)
by: execute_sqlcom_select (sql_parse.cc:4513)
by: mysql_execute_command (sql_parse.cc:2096)
by: mysql_parse (sql_parse.cc:5550)
by: dispatch_command (sql_parse.cc:1078)
by: do_command (sql_parse.cc:815)
by: do_handle_one_connection (sql_connect.cc:748)
by: handle_one_connection (sql_connect.cc:684)
by: start_thread (pthread_create.c:301)
 Uninitialised value was created by a stack allocation
   at 0x7FAA66: Item_func_year::val_int() (item_timefunc.cc:1303)

See attached file for full details of build and system.

How to repeat:
#run mysqld in valgrind. then:
select format(year(str_to_date('',get_format(time,''))),1);
[23 Dec 2010 11:24] MySQL Verification Team
some details....

Attachment: bug59125_more_infos.txt (text/plain), 31.25 KiB.

[23 Dec 2010 16:34] Valeriy Kravchuk
Verified with current mysql-5.1-security tree on 32-bit Ubuntu 10.04.
[27 Dec 2010 14:55] MySQL Verification Team
another testcase from mysql-trunk:

select format(day(from_unixtime('-128')),'','es_US');
[19 Apr 2011 16:36] Paul DuBois
Noted in 5.1.57, 5.5.12, 5.6.3 changelogs.

In Item_func::val_decimal, a Valgrind warning for a missing NULL 
value check was corrected. 

CHANGESET - http://lists.mysql.com/commits/134058