1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-19189 ASAN memcpy-param-overlap in fill_alter_inplace_info upon adding indexes

memmove() should be used instead of memcpy() for overlapping memory regions.

Overlapping memory regions itself here are fine, because code simply removes
one element from arbitrary position of an array.
This commit is contained in:
Eugene Kosov
2019-09-22 21:04:00 +03:00
parent 5a92ccbaea
commit e3da362c03
3 changed files with 21 additions and 4 deletions

View File

@ -7123,10 +7123,10 @@ static bool fill_alter_inplace_info(THD *thd, TABLE *table, bool varchar,
--ha_alter_info->index_add_count;
--ha_alter_info->index_drop_count;
memcpy(add_buffer + i, add_buffer + i + 1,
sizeof(add_buffer[0]) * (ha_alter_info->index_add_count - i));
memcpy(drop_buffer + j, drop_buffer + j + 1,
sizeof(drop_buffer[0]) * (ha_alter_info->index_drop_count - j));
memmove(add_buffer + i, add_buffer + i + 1,
sizeof(add_buffer[0]) * (ha_alter_info->index_add_count - i));
memmove(drop_buffer + j, drop_buffer + j + 1,
sizeof(drop_buffer[0]) * (ha_alter_info->index_drop_count - j));
--i; // this index once again
break;
}