• unknown's avatar
    Fix for bug #31174: "Repair" command on MyISAM crashes with small · 1c7b80df
    unknown authored
    myisam_sort_buffer_size.
    
    An incorrect length of the sort buffer was used when calculating the
    maximum number of keys. When myisam_sort_buffer_size is small enough,
    this could result in the number of keys < number of
    BUFFPEK structures which in turn led to use of uninitialized BUFFPEKs.
    
    Fixed by correcting the buffer length calculation.
    
    
    myisam/sort.c:
      Use a correct buffer length when calculating the maximum number of keys.
      Assert that for each BUFFPEK structure there is at least one
      corresponding key. Otherwise we would fail earlier and not reach
      merge_buffers().
    mysql-test/r/repair.result:
      Added a test case for bug #31174.
    mysql-test/t/repair.test:
      Added a test case for bug #31174.
    1c7b80df
repair.test 3.76 KB