Skip to content
  • Sreeharsha Ramanavarapu's avatar
    55146e0e
    Bug #21056907: CONTENTS OF NOT REQUESTED CHAR/VARCHAR · 55146e0e
    Sreeharsha Ramanavarapu authored
                   COLUMN ARE REVEALED
    
    Issue:
    -----
    When a hexadecimal representation of a string literal is
    passed as a parameter to the insert function, additional
    information is displayed by the SELECT statement.
    
    
    SOLUTION:
    ---------
    This happens because while creating the hexadecimal
    character, the "Alloced_length" is set to the string
    length, but the actual allocation does not happen. This
    will result in the same string being used for multiple
    rows, and the new string will be appended to the old one.
    
    The solution is to check whether a string is actually
    allocated, if not make sure that this is done.
    
    Also, when a string is supplied from a variable,
    String->realloc will result in truncation if 'to' and
    'from' overlap. This needs to be handled by forcing an
    allocation on the heap.
    
    Functions like lcase/encode/decode may return substrings
    that are already allocated on the heap. concat/concat_ws
    can have similar problems where temporary results are
    over-written. Here uses_buffer_owned_by() can be used
    to check if the input string is already allocated on the
    heap. If yes, a temporary variable is used to store the
    substring.
    
    This fix is a backport of Bug#11765149, Bug#20315088 and
    Bug#20554017.
    55146e0e
    Bug #21056907: CONTENTS OF NOT REQUESTED CHAR/VARCHAR
    Sreeharsha Ramanavarapu authored
                   COLUMN ARE REVEALED
    
    Issue:
    -----
    When a hexadecimal representation of a string literal is
    passed as a parameter to the insert function, additional
    information is displayed by the SELECT statement.
    
    
    SOLUTION:
    ---------
    This happens because while creating the hexadecimal
    character, the "Alloced_length" is set to the string
    length, but the actual allocation does not happen. This
    will result in the same string being used for multiple
    rows, and the new string will be appended to the old one.
    
    The solution is to check whether a string is actually
    allocated, if not make sure that this is done.
    
    Also, when a string is supplied from a variable,
    String->realloc will result in truncation if 'to' and
    'from' overlap. This needs to be handled by forcing an
    allocation on the heap.
    
    Functions like lcase/encode/decode may return substrings
    that are already allocated on the heap. concat/concat_ws
    can have similar problems where temporary results are
    over-written. Here uses_buffer_owned_by() can be used
    to check if the input string is already allocated on the
    heap. If yes, a temporary variable is used to store the
    substring.
    
    This fix is a backport of Bug#11765149, Bug#20315088 and
    Bug#20554017.
Loading