mirror of
https://github.com/MariaDB/server.git
synced 2025-01-30 18:41:56 +01:00
MDEV-16045: Fix a heap allocation
Since commit baa5a43d8c
changed the allocation of log_t::files::file_header_bufs[],
a memory overrun could occur when running with a non-default
setting of innodb_log_files_in_group.
log_t::files::create(): Correctly allocate n_files*2048 + 512
bytes of memory, to be aligned at a 512-byte boundary.
This commit is contained in:
parent
10d44db5d4
commit
b2f56085d4
1 changed files with 2 additions and 3 deletions
|
@ -675,9 +675,8 @@ void log_t::files::create(ulint n_files)
|
||||||
lsn= LOG_START_LSN;
|
lsn= LOG_START_LSN;
|
||||||
lsn_offset= LOG_FILE_HDR_SIZE;
|
lsn_offset= LOG_FILE_HDR_SIZE;
|
||||||
|
|
||||||
byte* ptr= static_cast<byte*>(ut_zalloc_nokey(LOG_FILE_HDR_SIZE
|
byte* ptr= static_cast<byte*>(ut_zalloc_nokey(LOG_FILE_HDR_SIZE * n_files
|
||||||
+ OS_FILE_LOG_BLOCK_SIZE
|
+ OS_FILE_LOG_BLOCK_SIZE));
|
||||||
* n_files));
|
|
||||||
file_header_bufs_ptr= ptr;
|
file_header_bufs_ptr= ptr;
|
||||||
ptr= static_cast<byte*>(ut_align(ptr, OS_FILE_LOG_BLOCK_SIZE));
|
ptr= static_cast<byte*>(ut_align(ptr, OS_FILE_LOG_BLOCK_SIZE));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue