Commit e90add96 authored by unknown's avatar unknown

filesort.cc:

  Bug#33675: Usage of an uninitialized memory by filesort in a subquery caused
  server crash.
  Free smaller buffer before allocating bigger one.


sql/filesort.cc:
  Bug#33675: Usage of an uninitialized memory by filesort in a subquery caused
  server crash.
  Free smaller buffer before allocating bigger one.
parent 34095e24
...@@ -239,10 +239,14 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length, ...@@ -239,10 +239,14 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
} }
else else
{ {
if (table_sort.buffpek && table_sort.buffpek_len < maxbuffer)
{
x_free(table_sort.buffpek);
table_sort.buffpek= 0;
}
if (!(table_sort.buffpek= if (!(table_sort.buffpek=
read_buffpek_from_file(&buffpek_pointers, maxbuffer, read_buffpek_from_file(&buffpek_pointers, maxbuffer,
(table_sort.buffpek_len < maxbuffer ? table_sort.buffpek)))
NULL : table_sort.buffpek))))
goto err; goto err;
buffpek= (BUFFPEK *) table_sort.buffpek; buffpek= (BUFFPEK *) table_sort.buffpek;
table_sort.buffpek_len= maxbuffer; table_sort.buffpek_len= maxbuffer;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment