• unknown's avatar
    Fixed bug#15351: Wrong collation used for comparison of md5() and sha() · 43a94ac2
    unknown authored
    argument can lead to a wrong result.
    
    md5() and sha() functions treat their arguments as case sensitive strings.
    But when they are compared their arguments were compared as a case
    insensitive strings which leads to two functions with different arguments
    and thus different results to being identical. This can lead to a wrong
    decision made in the range optimizer and thus lead to a wrong result set.
    
    Item_func_md5::fix_length_and_dec() and Item_func_sha::fix_length_and_dec()
    functions now set binary collation on their arguments.
    
    
    sql/item_strfunc.cc:
      Fixed bug#15351: Wrong collation used for comparison of md5() and sha()
      argument can lead to a wrong result.
      Item_func_md5::fix_length_and_dec() and Item_func_sha::fix_length_and_dec()
      functions now set binary collation on their arguments.
    mysql-test/r/func_str.result:
       Added test case for the bug#15351: Wrong collation used for comparison of md5() and sha()
      argument can lead to a wrong result.
    mysql-test/t/func_str.test:
      Added test case for the bug#15351: Wrong collation used for comparison of md5() and sha()
      argument can lead to a wrong result.
    43a94ac2
item_strfunc.cc 74.8 KB