mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
MDEV-4293 Valgrind warnings (Conditional jump or move depends on uninitialised value) in remove_eq_conds on time functions with NULL argument
val_int() is expected to return 0 for NULL's
This commit is contained in:
parent
8f607aae12
commit
1be4295617
3 changed files with 28 additions and 12 deletions
|
@ -1898,3 +1898,15 @@ microsecond('12:00:00.123456') microsecond('2009-12-31 23:59:59.000010')
|
|||
123456 10
|
||||
select now(258);
|
||||
ERROR 42000: Too big precision 258 specified for 'now'. Maximum is 6.
|
||||
SELECT 1 FROM DUAL WHERE YEAR(TIMEDIFF(NULL, '12:12:12'));
|
||||
1
|
||||
SELECT 1 FROM DUAL WHERE MONTH(TIMEDIFF(NULL, '12:12:12'));
|
||||
1
|
||||
SELECT 1 FROM DUAL WHERE DAYOFMONTH(TIMEDIFF(NULL, '12:12:12'));
|
||||
1
|
||||
SELECT 1 FROM DUAL WHERE HOUR(TIMEDIFF(NULL, '12:12:12'));
|
||||
1
|
||||
SELECT 1 FROM DUAL WHERE MINUTE(TIMEDIFF(NULL, '12:12:12'));
|
||||
1
|
||||
SELECT 1 FROM DUAL WHERE SECOND(TIMEDIFF(NULL, '12:12:12'));
|
||||
1
|
||||
|
|
|
@ -1144,3 +1144,13 @@ select microsecond('12:00:00.123456'), microsecond('2009-12-31 23:59:59.000010')
|
|||
|
||||
--error ER_TOO_BIG_PRECISION
|
||||
select now(258);
|
||||
|
||||
#
|
||||
# MDEV-4293 Valgrind warnings (Conditional jump or move depends on uninitialised value) in remove_eq_conds on time functions with NULL argument in WHERE
|
||||
#
|
||||
SELECT 1 FROM DUAL WHERE YEAR(TIMEDIFF(NULL, '12:12:12'));
|
||||
SELECT 1 FROM DUAL WHERE MONTH(TIMEDIFF(NULL, '12:12:12'));
|
||||
SELECT 1 FROM DUAL WHERE DAYOFMONTH(TIMEDIFF(NULL, '12:12:12'));
|
||||
SELECT 1 FROM DUAL WHERE HOUR(TIMEDIFF(NULL, '12:12:12'));
|
||||
SELECT 1 FROM DUAL WHERE MINUTE(TIMEDIFF(NULL, '12:12:12'));
|
||||
SELECT 1 FROM DUAL WHERE SECOND(TIMEDIFF(NULL, '12:12:12'));
|
||||
|
|
|
@ -856,16 +856,14 @@ longlong Item_func_dayofmonth::val_int()
|
|||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
MYSQL_TIME ltime;
|
||||
(void) get_arg0_date(<ime, TIME_FUZZY_DATE);
|
||||
return (longlong) ltime.day;
|
||||
return get_arg0_date(<ime, TIME_FUZZY_DATE) ? 0 : (longlong) ltime.day;
|
||||
}
|
||||
|
||||
longlong Item_func_month::val_int()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
MYSQL_TIME ltime;
|
||||
(void) get_arg0_date(<ime, TIME_FUZZY_DATE);
|
||||
return (longlong) ltime.month;
|
||||
return get_arg0_date(<ime, TIME_FUZZY_DATE) ? 0 : (longlong) ltime.month;
|
||||
}
|
||||
|
||||
|
||||
|
@ -919,16 +917,14 @@ longlong Item_func_hour::val_int()
|
|||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
MYSQL_TIME ltime;
|
||||
(void) get_arg0_time(<ime);
|
||||
return ltime.hour;
|
||||
return get_arg0_time(<ime) ? 0 : ltime.hour;
|
||||
}
|
||||
|
||||
longlong Item_func_minute::val_int()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
MYSQL_TIME ltime;
|
||||
(void) get_arg0_time(<ime);
|
||||
return ltime.minute;
|
||||
return get_arg0_time(<ime) ? 0 : ltime.minute;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -938,8 +934,7 @@ longlong Item_func_second::val_int()
|
|||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
MYSQL_TIME ltime;
|
||||
(void) get_arg0_time(<ime);
|
||||
return ltime.second;
|
||||
return get_arg0_time(<ime) ? 0 : ltime.second;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1056,8 +1051,7 @@ longlong Item_func_year::val_int()
|
|||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
MYSQL_TIME ltime;
|
||||
(void) get_arg0_date(<ime, TIME_FUZZY_DATE);
|
||||
return (longlong) ltime.year;
|
||||
return get_arg0_date(<ime, TIME_FUZZY_DATE) ? 0 : (longlong) ltime.year;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue