summaryrefslogtreecommitdiff
path: root/sql
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
commita44794d05eb03d8ed996281dfee0161c8bd137a7 (patch)
tree44f310b17e8eaa5a04427b7cf200d4e234464f98 /sql
parentcd6f3b55dab602069f43ed08fd3949d1226c2c50 (diff)
downloadmariadb-git-a44794d05eb03d8ed996281dfee0161c8bd137a7.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')
-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;