MDEV-32523 ASAN errors or assertion failure in row_merge_buf_add

innobase_build_col_map_add(): InnoDB wrongly copies the old field
record into default value even when new field length has been changed.
parent 4941ac91
......@@ -507,3 +507,14 @@ name pos mtype prtype len
a 0 1 524303 110
drop table t;
# End of 10.2 tests
#
# MDEV-32523 ASAN errors or assertion failure in row_merge_buf_add
#
CREATE TABLE t (a INT, b VARCHAR(16)) ENGINE=InnoDB;
INSERT INTO t (a) VALUES (1),(2);
ALTER TABLE t MODIFY b VARCHAR(16) DEFAULT '0';
ALTER IGNORE TABLE t MODIFY b VARCHAR(12289) NOT NULL;
Warnings:
Warning 1265 Data truncated for column 'b' at row 1
Warning 1265 Data truncated for column 'b' at row 2
DROP TABLE t;
......@@ -373,3 +373,13 @@ on sc.table_id=st.table_id where st.name='test/t' and sc.name='a';
drop table t;
--echo # End of 10.2 tests
--echo #
--echo # MDEV-32523 ASAN errors or assertion failure in row_merge_buf_add
--echo #
CREATE TABLE t (a INT, b VARCHAR(16)) ENGINE=InnoDB;
INSERT INTO t (a) VALUES (1),(2);
ALTER TABLE t MODIFY b VARCHAR(16) DEFAULT '0';
ALTER IGNORE TABLE t MODIFY b VARCHAR(12289) NOT NULL;
# Cleanup
DROP TABLE t;
......@@ -4558,7 +4558,11 @@ static void innobase_build_col_map_add(
return;
}
const Field& from = old_field ? *old_field : *field;
const Field& from =
old_field && (old_field->field_length
== field->field_length)
? *old_field : *field;
ulint size = from.pack_length();
byte* buf = static_cast<byte*>(mem_heap_alloc(heap, size));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment