From 6cefe7d31ef43cadb905d71be743462825c7b4ff Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sun, 2 Aug 2020 10:30:46 +0200 Subject: cleanup: use predefined CMAKE_DL_LIBS instead of, say, MY_SEARCH_LIBS(dlopen dl LIBDL) --- mysys/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mysys') diff --git a/mysys/CMakeLists.txt b/mysys/CMakeLists.txt index 0a61c856506..3505f417762 100644 --- a/mysys/CMakeLists.txt +++ b/mysys/CMakeLists.txt @@ -75,7 +75,7 @@ ENDIF() ADD_CONVENIENCE_LIBRARY(mysys ${MYSYS_SOURCES}) TARGET_LINK_LIBRARIES(mysys dbug strings ${ZLIB_LIBRARY} - ${LIBNSL} ${LIBM} ${LIBRT} ${LIBDL} ${LIBSOCKET} ${LIBEXECINFO} ${CRC32_LIBRARY}) + ${LIBNSL} ${LIBM} ${LIBRT} ${CMAKE_DL_LIBS} ${LIBSOCKET} ${LIBEXECINFO} ${CRC32_LIBRARY}) DTRACE_INSTRUMENT(mysys) IF(HAVE_BFD_H) -- cgit v1.2.1 From b94e8e4b25e039b5f165339b8ee0fd4af856459c Mon Sep 17 00:00:00 2001 From: Varun Gupta Date: Fri, 23 Oct 2020 12:32:49 +0530 Subject: MDEV-23867: insert... select crash in compute_window_func There are 2 issues here: Issue #1: memory allocation. An IO_CACHE that uses encryption uses a larger buffer (it needs space for the encrypted data, decrypted data, IO_CACHE_CRYPT struct to describe encryption parameters etc). Issue #2: IO_CACHE::seek_not_done When IO_CACHE objects are cloned, they still share the file descriptor. This means, operation on one IO_CACHE may change the file read position which will confuse other IO_CACHEs using it. The fix of these issues would be: Allocate the buffer to also include the extra size needed for encryption. Perform seek again after one IO_CACHE reads the file. --- mysys/mf_iocache.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'mysys') diff --git a/mysys/mf_iocache.c b/mysys/mf_iocache.c index 5d74ba42677..e09c7f930c8 100644 --- a/mysys/mf_iocache.c +++ b/mysys/mf_iocache.c @@ -250,7 +250,7 @@ int init_io_cache(IO_CACHE *info, File file, size_t cachesize, info->write_buffer= info->buffer + cachesize; else info->write_buffer= info->buffer; - info->alloced_buffer= 1; + info->alloced_buffer= buffer_block; break; /* Enough memory found */ } if (cachesize == min_cache) @@ -324,14 +324,14 @@ int init_slave_io_cache(IO_CACHE *master, IO_CACHE *slave) DBUG_ASSERT(!master->share); DBUG_ASSERT(master->alloced_buffer); - if (!(slave_buf= (uchar*)my_malloc(master->buffer_length, MYF(0)))) + if (!(slave_buf= (uchar*)my_malloc(master->alloced_buffer, MYF(0)))) { return 1; } memcpy(slave, master, sizeof(IO_CACHE)); slave->buffer= slave_buf; - memcpy(slave->buffer, master->buffer, master->buffer_length); + memcpy(slave->buffer, master->buffer, master->alloced_buffer); slave->read_pos= slave->buffer + (master->read_pos - master->buffer); slave->read_end= slave->buffer + (master->read_end - master->buffer); -- cgit v1.2.1