• Martin Hansson's avatar
    Bug#58165: "my_empty_string" gets modified and causes LOAD DATA to fail and · 716b64cd
    Martin Hansson authored
    other crashes
    
    Some string manipulating SQL functions use a shared string object intended to
    contain an immutable empty string. This object was used by the SQL function
    SUBSTRING_INDEX() to return an empty string when one argument was of the wrong
    datatype. If the string object was then modified by the sql function INSERT(),
    undefined behavior ensued.
    
    Fixed by instead modifying the string object representing the function's
    result value whenever string manipulating SQL functions return an empty
    string.
    
    Relevant code has also been documented.
    716b64cd
sql_string.h 12 KB