mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
Bug#11766124 59164: VALGRIND: UNINITIALIZED VALUE IN NUMBER_TO_DATETIME
Valgrind warning happens due to missing NULL value check in Item::get_date. The fix is to add this check. mysql-test/r/func_time.result: test case mysql-test/t/func_time.test: test case sql/item.cc: added check for NULL value
This commit is contained in:
parent
3b7f044534
commit
a7d383cbb8
3 changed files with 17 additions and 1 deletions
|
@ -1399,4 +1399,10 @@ NULL
|
|||
SELECT CAST((MONTH(FROM_UNIXTIME(@@GLOBAL.SQL_MODE))) AS BINARY(1025));
|
||||
CAST((MONTH(FROM_UNIXTIME(@@GLOBAL.SQL_MODE))) AS BINARY(1025))
|
||||
NULL
|
||||
#
|
||||
# Bug#11766124 59164: VALGRIND: UNINITIALIZED VALUE IN NUMBER_TO_DATETIME
|
||||
#
|
||||
SELECT ADDDATE(MONTH(FROM_UNIXTIME(NULL)),INTERVAL 1 HOUR);
|
||||
ADDDATE(MONTH(FROM_UNIXTIME(NULL)),INTERVAL 1 HOUR)
|
||||
NULL
|
||||
End of 5.1 tests
|
||||
|
|
|
@ -907,4 +907,10 @@ SELECT FORMAT(YEAR(STR_TO_DATE('',GET_FORMAT(TIME,''))),1);
|
|||
|
||||
SELECT CAST((MONTH(FROM_UNIXTIME(@@GLOBAL.SQL_MODE))) AS BINARY(1025));
|
||||
|
||||
--echo #
|
||||
--echo # Bug#11766124 59164: VALGRIND: UNINITIALIZED VALUE IN NUMBER_TO_DATETIME
|
||||
--echo #
|
||||
|
||||
SELECT ADDDATE(MONTH(FROM_UNIXTIME(NULL)),INTERVAL 1 HOUR);
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
|
|
@ -926,8 +926,12 @@ bool Item::get_date(MYSQL_TIME *ltime,uint fuzzydate)
|
|||
}
|
||||
else
|
||||
{
|
||||
longlong value= val_int();
|
||||
int was_cut;
|
||||
longlong value= val_int();
|
||||
|
||||
if (null_value)
|
||||
goto err;
|
||||
|
||||
if (number_to_datetime(value, ltime, fuzzydate, &was_cut) == LL(-1))
|
||||
{
|
||||
char buff[22], *end;
|
||||
|
|
Loading…
Add table
Reference in a new issue