summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorTor Didriksen <tor.didriksen@oracle.com>2013-11-01 16:39:19 +0100
committerTor Didriksen <tor.didriksen@oracle.com>2013-11-01 16:39:19 +0100
commite0f3a0fae98bea144b962ef8dbbe62e0935aebb1 (patch)
tree96ae5e4094c90d7cd779ad752e1e095854b0fd2a /sql
parente87a37a2de41c6d0316fe501a33b57fa9a382abb (diff)
downloadmariadb-git-e0f3a0fae98bea144b962ef8dbbe62e0935aebb1.tar.gz
Bug#17617945 BUFFER OVERFLOW IN GET_MERGE_MANY_BUFFS_COST WITH SMALL SORT_BUFFER_SIZE
get_cost_calc_buff_size() could return wrong value for the size of imerge_cost_buff.
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_class.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 9a9b2058e2b..fd83930a8e9 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -2987,11 +2987,13 @@ public:
bool get(TABLE *table);
static double get_use_cost(uint *buffer, uint nkeys, uint key_size,
ulonglong max_in_memory_size);
+
+ // Returns the number of bytes needed in imerge_cost_buf.
inline static int get_cost_calc_buff_size(ulong nkeys, uint key_size,
ulonglong max_in_memory_size)
{
register ulonglong max_elems_in_tree=
- (1 + max_in_memory_size / ALIGN_SIZE(sizeof(TREE_ELEMENT)+key_size));
+ (max_in_memory_size / ALIGN_SIZE(sizeof(TREE_ELEMENT)+key_size));
return (int) (sizeof(uint)*(1 + nkeys/max_elems_in_tree));
}