summaryrefslogtreecommitdiff
path: root/sql/filesort.cc
diff options
context:
space:
mode:
authorTor Didriksen <tor.didriksen@oracle.com>2013-10-29 17:26:20 +0100
committerTor Didriksen <tor.didriksen@oracle.com>2013-10-29 17:26:20 +0100
commit3b63182ec4adcfe14146c69a9c69e05552257e0f (patch)
tree44f310b17e8eaa5a04427b7cf200d4e234464f98 /sql/filesort.cc
parentdf5018f2b1a0c8a8706f3c1f84ad4791c6048de4 (diff)
downloadmariadb-git-3b63182ec4adcfe14146c69a9c69e05552257e0f.tar.gz
Bug#17326567 MYSQL SERVER FILESORT IMPLEMENTATION HAS A VERY SERIOUS BUG
The filesort implementation needs space for at least 15 records (plus some internal overhead) in its main sort buffer.
Diffstat (limited to 'sql/filesort.cc')
-rw-r--r--sql/filesort.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/sql/filesort.cc b/sql/filesort.cc
index 3a2102fa62b..a067f0236ed 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -216,7 +216,10 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
goto err;
memavl= thd->variables.sortbuff_size;
- min_sort_memory= max(MIN_SORT_MEMORY, param.sort_length*MERGEBUFF2);
+ min_sort_memory=
+ max(MIN_SORT_MEMORY,
+ ALIGN_SIZE(MERGEBUFF2 * (param.rec_length + sizeof(uchar*))));
+
while (memavl >= min_sort_memory)
{
ulong old_memavl;