• gluh@mysql.com/eagle.(none)'s avatar
    Bug#30889: filesort and order by with float/numeric crashes server · 6b92ec4a
    gluh@mysql.com/eagle.(none) authored
    There are two problems with ROUND(X, D) on an exact numeric 
    (DECIMAL, NUMERIC type) field of a table:
    1) The implementation of the ROUND function would change the number of decimal
    places regardless of the value decided upon in fix_length_and_dec. When the
    number of decimal places is not constant, this would cause an inconsistent
    state where the number of digits was less than the number of decimal places,
    which crashes filesort.
    
    Fixed by not allowing the ROUND operation to add any more decimal places than
    was decided in fix_length_and_dec.
    
    2) fix_length_and_dec would allow the number of decimals to be greater than
    the maximium configured value for constant values of D. This led to the same 
    crash as in (1).
    
    Fixed by not allowing the above in fix_length_and_dec.
    6b92ec4a
item_func.cc 137 KB