• Sergey Vojtovich's avatar
    BUG#47598 - MyISAM may write uninitialized data to disk · 85094f3c
    Sergey Vojtovich authored
    When MyISAM writes newly created index page it may be
    initialized partially. In other words some bytes of
    sensible data and uninitialized tail of the page may
    go into index file.
    
    Under certain rare circumstances these hunks of memory
    may contain data that would be otherwise inaccessible
    to user, like passwords or data from other tables.
    
    Fixed by initializing memory for temporary MyISAM key
    buffer to '\0'.
    
    No test case for this fix as it is heavily covered by
    existing tests.
    
    storage/myisam/mi_open.c:
      When creating new MI_INFO object, initialize MI_INFO::buff.
      This is done to ensure that we never write uninitialized
      memory hunks to index file.
    storage/myisam/mi_page.c:
      No need to silence memory error detector anymore,
      page buffer is always initialized.
    storage/myisam/mi_write.c:
      Fixed invalid memory read of 2 bytes. new_right_length
      is length of data on a page, including first 2 bytes
      that store this length itself. pos + k_length is pure
      data excluding these 2 bytes containing length.
    storage/myisam/rt_index.c:
      To avoid uninitialized data write, create new page
      on info->buff, instead of locally allocated buffer.
      
      Note: second key block on info->buff is used here,
      because first block is used by called functions.
    storage/myisam/rt_split.c:
      To avoid uninitialized data write, create new page
      on info->buff, instead of locally allocated buffer.
    85094f3c
mi_open.c 43.1 KB