diff options
author | Varun Gupta <varun.gupta@mariadb.com> | 2020-10-23 12:32:49 +0530 |
---|---|---|
committer | Varun Gupta <varun.gupta@mariadb.com> | 2020-10-23 22:36:47 +0530 |
commit | b94e8e4b25e039b5f165339b8ee0fd4af856459c (patch) | |
tree | 95f0e9b6fe4603d9df2b198b2895d245fa4d284d /include | |
parent | 5a9df1550f256b7be7aaffbf4cbce13d0ca22566 (diff) | |
download | mariadb-git-b94e8e4b25e039b5f165339b8ee0fd4af856459c.tar.gz |
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.
Diffstat (limited to 'include')
-rw-r--r-- | include/my_sys.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/include/my_sys.h b/include/my_sys.h index fe66aeef48c..08b06951d0d 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -476,18 +476,19 @@ typedef struct st_io_cache /* Used when cacheing files */ partial. */ int seek_not_done,error; - /* buffer_length is memory size allocated for buffer or write_buffer */ + /* length of the buffer used for storing un-encrypted data */ size_t buffer_length; /* read_length is the same as buffer_length except when we use async io */ size_t read_length; myf myflags; /* Flags used to my_read/my_write */ /* - alloced_buffer is 1 if the buffer was allocated by init_io_cache() and - 0 if it was supplied by the user. + alloced_buffer is set to the size of the buffer allocated for the IO_CACHE. + Includes the overhead(storing key to ecnrypt and decrypt) for encryption. + Set to 0 if nothing is allocated. Currently READ_NET is the only one that will use a buffer allocated somewhere else */ - my_bool alloced_buffer; + size_t alloced_buffer; #ifdef HAVE_AIOWAIT /* As inidicated by ifdef, this is for async I/O, which is not currently |