summaryrefslogtreecommitdiff
path: root/sql/table.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2022-10-25 14:25:42 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2022-10-25 14:25:42 +0300
commitaeccbbd926e759a5c3b9818d9948a35918404478 (patch)
treee3ee68a92d2c77f986979e1638169280ede35a96 /sql/table.cc
parent75f7c5681c2592b50c26feff2371bd7ee973e535 (diff)
parent4b4c2b8cc0da949895292121ed5ef3e0c2dbaae1 (diff)
downloadmariadb-git-aeccbbd926e759a5c3b9818d9948a35918404478.tar.gz
Merge 10.5 into 10.6
To prevent ASAN heap-use-after-poison in the MDEV-16549 part of ./mtr --repeat=6 main.derived the initialization of Name_resolution_context was cleaned up.
Diffstat (limited to 'sql/table.cc')
-rw-r--r--sql/table.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/sql/table.cc b/sql/table.cc
index 163bb798962..526d7462f3b 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -673,7 +673,11 @@ enum open_frm_error open_table_def(THD *thd, TABLE_SHARE *share, uint flags)
if (!share->view_def)
share->error= OPEN_FRM_ERROR_ALREADY_ISSUED;
else
+ {
share->error= OPEN_FRM_OK;
+ if (mariadb_view_version_get(share))
+ share->error= OPEN_FRM_ERROR_ALREADY_ISSUED;
+ }
}
else
share->error= OPEN_FRM_NOT_A_TABLE;
@@ -8891,7 +8895,7 @@ int TABLE::update_virtual_field(Field *vf, bool ignore_warnings)
Counting_error_handler count_errors;
Suppress_warnings_error_handler warning_handler;
in_use->push_internal_handler(&count_errors);
- bool abort_on_warning;
+ bool abort_on_warning= ignore_warnings;
if (ignore_warnings)
{
abort_on_warning= in_use->abort_on_warning;
@@ -9660,7 +9664,8 @@ bool TABLE_LIST::change_refs_to_fields()
Item **materialized_items=
(Item **)thd->calloc(sizeof(void *) * table->s->fields);
- if (!materialized_items)
+ Name_resolution_context *ctx= new Name_resolution_context(this);
+ if (!materialized_items || !ctx)
return TRUE;
while ((ref= (Item_direct_ref*)li++))
@@ -9676,7 +9681,8 @@ bool TABLE_LIST::change_refs_to_fields()
DBUG_ASSERT(!field_it.end_of_fields());
if (!materialized_items[idx])
{
- materialized_items[idx]= new (thd->mem_root) Item_field(thd, table->field[idx]);
+ materialized_items[idx]=
+ new (thd->mem_root) Item_field(thd, ctx, table->field[idx]);
if (!materialized_items[idx])
return TRUE;
}