• Alexander Barkov's avatar
    MDEV-33534 UBSAN: Negation of -X cannot be represented in type 'long long... · 3141a68b
    Alexander Barkov authored
    MDEV-33534 UBSAN: Negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself in my_double_round from sql/item_func.cc|
    
    The negation in this line:
      ulonglong abs_dec= dec_negative ? -dec : dec;
    did not take into account that 'dec' can be the smallest possible
    signed negative value -9223372036854775808. Its negation is
    an operation with an undefined behavior.
    
    Fixing the code to use Longlong_hybrid, which implements a safe
    method to get an absolute value.
    3141a68b
func_math.result 113 KB