mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Bug#11766126 59166: ANOTHER DATETIME VALGRIND UNINITIALIZED WARNING
Valgrind warning happens because null values check happens too late in Item_func_month::val_str(after result string calculation).The fix is to check null value before result string calculation. mysql-test/r/func_time.result: test case mysql-test/t/func_time.test: test case sql/item_timefunc.h: check null value before result string calculation.
This commit is contained in:
@ -1393,4 +1393,10 @@ SET GLOBAL SQL_MODE=DEFAULT;
|
|||||||
SELECT FORMAT(YEAR(STR_TO_DATE('',GET_FORMAT(TIME,''))),1);
|
SELECT FORMAT(YEAR(STR_TO_DATE('',GET_FORMAT(TIME,''))),1);
|
||||||
FORMAT(YEAR(STR_TO_DATE('',GET_FORMAT(TIME,''))),1)
|
FORMAT(YEAR(STR_TO_DATE('',GET_FORMAT(TIME,''))),1)
|
||||||
NULL
|
NULL
|
||||||
|
#
|
||||||
|
# Bug#11766126 59166: ANOTHER DATETIME VALGRIND UNINITIALIZED WARNING
|
||||||
|
#
|
||||||
|
SELECT CAST((MONTH(FROM_UNIXTIME(@@GLOBAL.SQL_MODE))) AS BINARY(1025));
|
||||||
|
CAST((MONTH(FROM_UNIXTIME(@@GLOBAL.SQL_MODE))) AS BINARY(1025))
|
||||||
|
NULL
|
||||||
End of 5.1 tests
|
End of 5.1 tests
|
||||||
|
@ -901,4 +901,10 @@ SET GLOBAL SQL_MODE=DEFAULT;
|
|||||||
|
|
||||||
SELECT FORMAT(YEAR(STR_TO_DATE('',GET_FORMAT(TIME,''))),1);
|
SELECT FORMAT(YEAR(STR_TO_DATE('',GET_FORMAT(TIME,''))),1);
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # Bug#11766126 59166: ANOTHER DATETIME VALGRIND UNINITIALIZED WARNING
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
SELECT CAST((MONTH(FROM_UNIXTIME(@@GLOBAL.SQL_MODE))) AS BINARY(1025));
|
||||||
|
|
||||||
--echo End of 5.1 tests
|
--echo End of 5.1 tests
|
||||||
|
@ -106,8 +106,11 @@ public:
|
|||||||
{ DBUG_ASSERT(fixed == 1); return (double) Item_func_month::val_int(); }
|
{ DBUG_ASSERT(fixed == 1); return (double) Item_func_month::val_int(); }
|
||||||
String *val_str(String *str)
|
String *val_str(String *str)
|
||||||
{
|
{
|
||||||
str->set(val_int(), &my_charset_bin);
|
longlong nr= val_int();
|
||||||
return null_value ? 0 : str;
|
if (null_value)
|
||||||
|
return 0;
|
||||||
|
str->set(nr, &my_charset_bin);
|
||||||
|
return str;
|
||||||
}
|
}
|
||||||
const char *func_name() const { return "month"; }
|
const char *func_name() const { return "month"; }
|
||||||
enum Item_result result_type () const { return INT_RESULT; }
|
enum Item_result result_type () const { return INT_RESULT; }
|
||||||
|
Reference in New Issue
Block a user