Bug #19372926 : 5.5.38 FAILS FUNC_MATH MTR TEST.

Issue :
-------
This seems for some platform -(LONGLONG_MIN) is
not flagged as out of range.

Fix:
----
Fix is backported from mysql-5.6 bug 14314156.
Fixed by adding an explicit test for this value in
Item_func_neg::int_op().
This commit is contained in:
mithun 2014-11-03 18:10:28 +05:30
commit c5dfdec568
2 changed files with 10 additions and 3 deletions

View file

@ -1760,7 +1760,13 @@ longlong Item_func_neg::int_op()
if ((null_value= args[0]->null_value))
return 0;
if (args[0]->unsigned_flag &&
(ulonglong) value > (ulonglong) LONGLONG_MAX + 1)
(ulonglong) value > (ulonglong) LONGLONG_MAX + 1ULL)
return raise_integer_overflow();
// For some platforms we need special handling of LONGLONG_MIN to
// guarantee overflow.
if (value == LONGLONG_MIN &&
!args[0]->unsigned_flag &&
!unsigned_flag)
return raise_integer_overflow();
return check_integer_overflow(-value, !args[0]->unsigned_flag && value < 0);
}