Commit 9b7886bb authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-28403 ASAN heap-use-after-free in String::copy / get_field_default_value

This reverts commit 5ba77222
but keeps the test. A different fix for

MDEV-21028 Server crashes in Query_arena::set_query_arena upon SELECT from view

internal temporary tables should use THD as expr_area
parent c5e68b6d
......@@ -167,8 +167,8 @@ create algorithm=temptable view v1 as select * from t1;
create algorithm=merge view v2 as select * from t1;
select default(a) = now() from v1;
default(a) = now()
NULL
NULL
1
1
select default(a) = now() from v2;
default(a) = now()
1
......@@ -191,16 +191,29 @@ default(v1)
2001-01-01 10:20:30
select default(v1) from (select v1 from t1 group by v1) dt;
default(v1)
0000-00-00 00:00:00
2001-01-01 10:20:30
drop table t1;
create table t1 (a text default '');
create algorithm=temptable view v1 as select * from t1;
insert into t1 values ('a');
select default(a) from v1;
default(a)
NULL
drop view v1;
drop table t1;
#
# MDEV-28403 ASAN heap-use-after-free in String::copy / get_field_default_value
#
create table t (a blob default 'x');
create view v as select * from t;
insert into t () values ();
update t set a = default;
select table_name,column_name,column_default from information_schema.columns where table_name = 'v';
table_name v
column_name a
column_default 'x'
drop view v;
drop table t;
#
# End of 10.2 tests
#
......@@ -165,6 +165,17 @@ select default(a) from v1;
drop view v1;
drop table t1;
--echo #
--echo # MDEV-28403 ASAN heap-use-after-free in String::copy / get_field_default_value
--echo #
create table t (a blob default 'x');
create view v as select * from t;
insert into t () values ();
update t set a = default;
query_vertical select table_name,column_name,column_default from information_schema.columns where table_name = 'v';
drop view v;
drop table t;
--echo #
--echo # End of 10.2 tests
--echo #
......@@ -16333,8 +16333,7 @@ Field *create_tmp_field_from_field(THD *thd, Field *org_field,
table->s->db_create_options|= HA_OPTION_PACK_RECORD;
else if (org_field->type() == FIELD_TYPE_DOUBLE)
((Field_double *) new_field)->not_fixed= TRUE;
new_field->vcol_info= new_field->default_value=
new_field->check_constraint= 0;
new_field->vcol_info= 0;
new_field->cond_selectivity= 1.0;
new_field->next_equal_field= NULL;
new_field->option_list= NULL;
......@@ -16901,6 +16900,7 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
table->intersect_keys.init();
table->keys_in_use_for_query.init();
table->no_rows_with_nulls= param->force_not_null_cols;
table->expr_arena= thd;
table->s= share;
init_tmp_table_share(thd, share, "", 0, "(temporary)", tmpname);
......
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