mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 10:14:19 +01:00
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.
This commit is contained in:
parent
e87a37a2de
commit
e0f3a0fae9
1 changed files with 3 additions and 1 deletions
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue