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:
parent
5a92ccbaea
commit
e3da362c03
@ -176,3 +176,10 @@ check table rename_column_and_index;
|
||||
Table Op Msg_type Msg_text
|
||||
test.rename_column_and_index check status OK
|
||||
drop table rename_column_and_index;
|
||||
#
|
||||
# MDEV-19189: ASAN memcpy-param-overlap in fill_alter_inplace_info upon adding indexes
|
||||
#
|
||||
CREATE TABLE t1 (f1 INT, f2 INT, f3 INT);
|
||||
ALTER TABLE t1 ADD FOREIGN KEY f (f2) REFERENCES xx(f2);
|
||||
ALTER TABLE t1 ADD FOREIGN KEY (f2) REFERENCES t1(f2), ADD KEY (f3), ADD KEY (f1);
|
||||
DROP TABLE t1;
|
||||
|
@ -184,3 +184,13 @@ alter table rename_column_and_index
|
||||
show create table rename_column_and_index;
|
||||
check table rename_column_and_index;
|
||||
drop table rename_column_and_index;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-19189: ASAN memcpy-param-overlap in fill_alter_inplace_info upon adding indexes
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (f1 INT, f2 INT, f3 INT);
|
||||
ALTER TABLE t1 ADD FOREIGN KEY f (f2) REFERENCES xx(f2);
|
||||
ALTER TABLE t1 ADD FOREIGN KEY (f2) REFERENCES t1(f2), ADD KEY (f3), ADD KEY (f1);
|
||||
DROP TABLE t1;
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user