Commit 9d1c240a authored by Sergey Glukhov's avatar Sergey Glukhov

Bug#11766087 59125: VALGRIND UNINITIALISED VALUE WARNING IN ULL2DEC, LONGLONG2DECIMAL

Valgrind warning happens due to missing NULL value check in
Item_func::val_decimal. The fix is to add this check.
parent 9893d60e
...@@ -1387,4 +1387,10 @@ STR_TO_DATE(SPACE(2),'1') ...@@ -1387,4 +1387,10 @@ STR_TO_DATE(SPACE(2),'1')
SET GLOBAL SQL_MODE=''; SET GLOBAL SQL_MODE='';
DO STR_TO_DATE((''), FROM_DAYS(@@GLOBAL.SQL_MODE)); DO STR_TO_DATE((''), FROM_DAYS(@@GLOBAL.SQL_MODE));
SET GLOBAL SQL_MODE=DEFAULT; SET GLOBAL SQL_MODE=DEFAULT;
#
# Bug#11766087 59125: VALGRIND UNINITIALISED VALUE WARNING IN ULL2DEC, LONGLONG2DECIMAL
#
SELECT FORMAT(YEAR(STR_TO_DATE('',GET_FORMAT(TIME,''))),1);
FORMAT(YEAR(STR_TO_DATE('',GET_FORMAT(TIME,''))),1)
NULL
End of 5.1 tests End of 5.1 tests
...@@ -895,4 +895,10 @@ SET GLOBAL SQL_MODE=''; ...@@ -895,4 +895,10 @@ SET GLOBAL SQL_MODE='';
DO STR_TO_DATE((''), FROM_DAYS(@@GLOBAL.SQL_MODE)); DO STR_TO_DATE((''), FROM_DAYS(@@GLOBAL.SQL_MODE));
SET GLOBAL SQL_MODE=DEFAULT; SET GLOBAL SQL_MODE=DEFAULT;
--echo #
--echo # Bug#11766087 59125: VALGRIND UNINITIALISED VALUE WARNING IN ULL2DEC, LONGLONG2DECIMAL
--echo #
SELECT FORMAT(YEAR(STR_TO_DATE('',GET_FORMAT(TIME,''))),1);
--echo End of 5.1 tests --echo End of 5.1 tests
...@@ -482,7 +482,10 @@ bool Item_func::is_expensive_processor(uchar *arg) ...@@ -482,7 +482,10 @@ bool Item_func::is_expensive_processor(uchar *arg)
my_decimal *Item_func::val_decimal(my_decimal *decimal_value) my_decimal *Item_func::val_decimal(my_decimal *decimal_value)
{ {
DBUG_ASSERT(fixed); DBUG_ASSERT(fixed);
int2my_decimal(E_DEC_FATAL_ERROR, val_int(), unsigned_flag, decimal_value); longlong nr= val_int();
if (null_value)
return 0; /* purecov: inspected */
int2my_decimal(E_DEC_FATAL_ERROR, nr, unsigned_flag, decimal_value);
return decimal_value; return decimal_value;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment