MDEV-16125 Crash or ASAN heap-buffer-overflow in...

MDEV-16125 Crash or ASAN heap-buffer-overflow in mach_read_from_n_little_endian upon ALTER TABLE with blob

- Virtual column should be considered only to find the respective non-null fields.
But virtual column can never changed from NULL to NOT NULL.
parent e9f26097
...@@ -79,3 +79,10 @@ DROP TABLE t1; ...@@ -79,3 +79,10 @@ DROP TABLE t1;
CREATE TABLE t1 (a INT, v INT AS (a), d INT NOT NULL, e INT) ENGINE=InnoDB; CREATE TABLE t1 (a INT, v INT AS (a), d INT NOT NULL, e INT) ENGINE=InnoDB;
ALTER TABLE t1 FORCE, ALGORITHM=INPLACE; ALTER TABLE t1 FORCE, ALGORITHM=INPLACE;
DROP TABLE t1; DROP TABLE t1;
#
# MDEV-16126 Crash or ASAN heap-buffer-overflow in
# mach_read_from_n_little_endian upon ALTER TABLE with blob
#
CREATE TABLE t1(a INT, v INT AS (a), b INT, c BLOB) ENGINE=InnoDB;
ALTER TABLE t1 ADD PRIMARY KEY(b);
DROP TABLE t1;
...@@ -64,3 +64,12 @@ DROP TABLE t1; ...@@ -64,3 +64,12 @@ DROP TABLE t1;
CREATE TABLE t1 (a INT, v INT AS (a), d INT NOT NULL, e INT) ENGINE=InnoDB; CREATE TABLE t1 (a INT, v INT AS (a), d INT NOT NULL, e INT) ENGINE=InnoDB;
ALTER TABLE t1 FORCE, ALGORITHM=INPLACE; ALTER TABLE t1 FORCE, ALGORITHM=INPLACE;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # MDEV-16126 Crash or ASAN heap-buffer-overflow in
--echo # mach_read_from_n_little_endian upon ALTER TABLE with blob
--echo #
CREATE TABLE t1(a INT, v INT AS (a), b INT, c BLOB) ENGINE=InnoDB;
ALTER TABLE t1 ADD PRIMARY KEY(b);
DROP TABLE t1;
...@@ -3360,9 +3360,12 @@ innobase_build_col_map( ...@@ -3360,9 +3360,12 @@ innobase_build_col_map(
if (field->real_maybe_null() if (field->real_maybe_null()
&& !altered_field->real_maybe_null()) { && !altered_field->real_maybe_null()) {
/* Don't consider virtual column.
NULL to NOT NULL is not applicable
for virtual column. */
innobase_build_col_map_add( innobase_build_col_map_add(
heap, dtuple_get_nth_field( heap, dtuple_get_nth_field(
defaults, i + num_v), defaults, i),
altered_field, altered_field,
dict_table_is_comp(new_table)); dict_table_is_comp(new_table));
} }
......
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