Bug #59166 another datetime valgrind uninitialized warning
Submitted: 25 Dec 2010 6:52 Modified: 19 Apr 2011 17:15
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Closed Impact on me:
Category:MySQL Server: DML Severity:S3 (Non-critical)
Version:5.1.55,5.5.9,5.6.1,5.6.2 OS:Any
Assigned to: CPU Architecture:Any

[25 Dec 2010 6:52] Shane Bester
\o/ merry xmas! \o/

Version: '5.5.9-valgrind-max-debug'  socket: 'sock'  port: 3307  Source distribution
Thread 17:
Conditional jump or move depends on uninitialised value(s)
at: my_longlong10_to_str_8bit (ctype-simple.c:785)
by: String::set_int (sql_string.cc:98)
by: String::set (sql_string.h:174)
by: Item_func_month::val_str (item_timefunc.h:133)
by: Item_char_typecast::val_str (item_timefunc.cc:2519)
by: Item::send (item.cc:5840)
by: Protocol::send_result_set_row (protocol.cc:848)
by: select_send::send_data (sql_class.cc:1862)
by: JOIN::exec (sql_select.cc:1860)
by: mysql_select (sql_select.cc:2571)
by: handle_select (sql_select.cc:297)
by: execute_sqlcom_select (sql_parse.cc:4472)
by: mysql_execute_command (sql_parse.cc:2053)
by: mysql_parse (sql_parse.cc:5509)
by: dispatch_command (sql_parse.cc:1035)
by: do_command (sql_parse.cc:772)
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: Item_func_month::val_int (item_timefunc.cc:1111)

5.0.92 not affected..

How to repeat:
#start mysqld in valgrind, then:
select cast((month(from_unixtime(@@global.sql_mode))) as binary(1025));
[25 Dec 2010 7:31] Sveta Smirnova
Sorry, mixed 2 bug reports. Ignore earlier comments. Verified as described.
[4 Jan 2011 8:10] MySQL Verification Team
another testcase:

do mpointfromwkb(month(from_days(date_add(('2.2250738585072014E-308'),interval ('1') SECOND_MICROSECOND))));

It would appear datetime functions in general don't initialize things properly.
related: bug #59270 and bug #59164
[3 Feb 2011 8:42] MySQL Verification Team
to the person who fixes this: please import this sql file (using --force or source <file>) and make sure no valgrind warnings!!

Attachment: bug59166_extended_global_variables_valgrind_test.txt (text/plain), 18.42 KiB.

[19 Apr 2011 17:15] Paul DuBois
Noted in 5.1.57, 5.5.12, 5.6.3 changelogs.

In Item_func_month::val_str(), a Valgrind warning for a too-late NULL
value check was corrected. 

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