• Gleb Shchepa's avatar
    buckport to 5.1.26 from 6.0 · c5f3597f
    Gleb Shchepa authored
    Bug#35658 (An empty binary value leads to mysqld crash)
      
    Before this fix, the following token
      b''
    caused the parser to crash when reading the binary value from the empty string.
    The crash was caused by:
      ptr+= max_length - 1;
    because max_length is unsigned and was 0, causing an overflow.
      
    With this fix, an empty binary literal b'' is parsed as a binary value 0,
    in Item_bin_string.
    
    mysql-test/r/varbinary.result:
      Bug#35658 (An empty binary value leads to mysqld crash)
    mysql-test/t/varbinary.test:
      Bug#35658 (An empty binary value leads to mysqld crash)
    sql/item.cc:
      Bug#35658 (An empty binary value leads to mysqld crash)
    c5f3597f
item.cc 197 KB