Skip to content

Commit 9a055d9

Browse files
author
Tor Didriksen
committed
Bug#27108794 CLANG/ASAN: STACK-USE-AFTER-SCOPE TABLE_UPGRADE_GUARD::~TABLE_UPGRADE_GUARD
To repeat: cmake -DWITH_ASAN=1 -DWITH_ASAN_SCOPE=1 ./mtr --mem --sanitize main.dd_upgrade_error A few dd tests fail with: ==26861==ERROR: AddressSanitizer: stack-use-after-scope on address 0x7000063bf5e8 at pc 0x00010d4dbe8b bp 0x7000063bda40 sp 0x7000063bda38 READ of size 8 at 0x7000063bf5e8 thread T2 #0 0x10d4dbe8a in Prealloced_array<st_plugin_int**, 16ul>::empty() const prealloced_array.h:186 #1 0x10d406a8b in lex_end(LEX*) sql_lex.cc:560 #2 0x10dae4b6d in dd::upgrade::Table_upgrade_guard::~Table_upgrade_guard() (mysqld:x86_64+0x100f87b6d) #3 0x10dadc557 in dd::upgrade::migrate_table_to_dd(THD*, std::__1::basic_string<char, std::__1::char_traits<char>, Stateless_allocator<char, dd::String_type_alloc, My_free_functor> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, Stateless_allocator<char, dd::String_type_alloc, My_free_functor> > const&, bool) (mysqld:x86_64+0x100f7f557) #4 0x10dad7e85 in dd::upgrade::migrate_plugin_table_to_dd(THD*) (mysqld:x86_64+0x100f7ae85) #5 0x10daec6a1 in dd::upgrade::do_pre_checks_and_initialize_dd(THD*) upgrade.cc:1216 #6 0x10cd0a5c0 in bootstrap::handle_bootstrap(void*) bootstrap.cc:336 Change-Id: I265ec6dd97ee8076aaf03763840c0cdf9e20325b Fix: increase lifetime of 'LEX lex;' which is used by 'table_guard'
1 parent 976fbc5 commit 9a055d9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sql/dd/upgrade/table.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1634,6 +1634,7 @@ static bool migrate_table_to_dd(THD *thd,
16341634
}
16351635

16361636
// Object to handle cleanup.
1637+
LEX lex;
16371638
Table_upgrade_guard table_guard(thd, table, &table->mem_root);
16381639

16391640
// Dont upgrade tables, we are fixing dependency for views.
@@ -1789,7 +1790,6 @@ static bool migrate_table_to_dd(THD *thd,
17891790
// open_table_from_share and partition expression parsing needs a
17901791
// valid SELECT_LEX to parse generated columns
17911792
LEX *lex_saved= thd->lex;
1792-
LEX lex;
17931793
thd->lex= &lex;
17941794
lex_start(thd);
17951795
table_guard.update_lex(lex_saved);

0 commit comments

Comments
 (0)