Hi!
On Oct 11, Alexey Kopytov wrote:
> ChangeSet@stripped, 2007-10-11 14:28:12+04:00, kaa@polly.(none) +3 -0
> Fix for bug #31174: "Repair" command on MyISAM crashes with small
> 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.
ok to push
> diff -Nrup a/myisam/sort.c b/myisam/sort.c
> --- a/myisam/sort.c 2007-05-05 01:38:28 +04:00
> +++ b/myisam/sort.c 2007-10-11 14:28:08 +04:00
> @@ -559,9 +559,10 @@ int thr_write_keys(MI_SORT_PARAM *sort_p
> if (!mergebuf)
> {
> length=param->sort_buffer_length;
> - while (length >= MIN_SORT_MEMORY && !mergebuf)
> + while (length >= MIN_SORT_MEMORY)
> {
> - mergebuf=my_malloc(length, MYF(0));
> + if ((mergebuf= my_malloc(length, MYF(0))))
> + break;
> length=length*3/4;
> }
> if (!mergebuf)
> @@ -897,6 +898,7 @@ merge_buffers(MI_SORT_PARAM *info, uint
>
> count=error=0;
> maxcount=keys/((uint) (Tb-Fb) +1);
> + DBUG_ASSERT(maxcount > 0);
> LINT_INIT(to_start_filepos);
> if (to_file)
> to_start_filepos=my_b_tell(to_file);
Regards / Mit vielen Grüssen,
Sergei
--
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Sergei Golubchik <serg@stripped>
/ /|_/ / // /\ \/ /_/ / /__ Principal Software Developer
/_/ /_/\_, /___/\___\_\___/ MySQL GmbH, Dachauer Str. 37, D-80335 München
<___/ Geschäftsführer: Kaj Arnö - HRB
München 162140