MDEV-22590 SIGSEGV in flush_all_key_blocks when changing key_buffer_size / ASAN: heap-use-after-free in flush_all_key_blocks

Take into account that in preparation of a simple key cache for resizing no disk blocks might be assigned to it.

Reviewer: IgorBabaev <igor@mariadb.com>
This commit is contained in:
Oleksandr Byelkin 2022-06-23 14:48:29 +02:00
commit 5feb60ce18
3 changed files with 44 additions and 1 deletions

View file

@ -701,7 +701,7 @@ int prepare_resize_simple_key_cache(SIMPLE_KEY_CACHE_CB *keycache,
keycache->in_resize= 1;
/* Need to flush only if keycache is enabled. */
if (keycache->can_be_used)
if (keycache->can_be_used && keycache->disk_blocks != -1)
{
/* Start the flush phase. */
keycache->resize_in_flush= 1;