Skip to content

Commit b80fa40

Browse files
committed
bug: ha_heap was unilaterally increasing reclength
MEMORY engine needs the record length to be at least sizeof(void*), because it stores a pointer there (linking deleted records into a list). So when the reclength is less than sizeof(void*), it's set to sizeof(void*). That is done inside heap_create(), and the upper layer doesn't know that the engine writes beyond share->reclength. While it's usually safe (in-memory record size is rounded up to sizeof(double), so even if share->reclength is too small, share->rec_buff_len is not), it could cause problems in the code that copies records and expects them to fix in share->reclength, e.g. in partitioning.
1 parent 444587d commit b80fa40

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

storage/heap/ha_heap.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ const char **ha_heap::bas_ext() const
100100

101101
int ha_heap::open(const char *name, int mode, uint test_if_locked)
102102
{
103+
set_if_bigger(table->s->reclength, sizeof (uchar*));
103104
internal_table= test(test_if_locked & HA_OPEN_INTERNAL_TABLE);
104105
if (internal_table || (!(file= heap_open(name, mode)) && my_errno == ENOENT))
105106
{

0 commit comments

Comments
 (0)