Skip to content

Commit 227ffcd

Browse files
author
Tor Didriksen
committed
Bug #33142654 THE SECOND HEAP-USE-AFTER-FREE ISSUE OF MYSQL SERVER
As part of optimizer trace in the range optimizer, we try to print a view definition, and this may access uninitialized data. This patch Bug#21929967 GCOLS: GCOL VALUE CHANGES WHEN SESSION CHANGES SQL_MODE introduced QT_NO_TABLE for printing identifiers. The fix is to test the QT_NO_TABLE flag before accessing table_name. Change-Id: I976cc2464e289851972c1151a122573f6f45f5ea
1 parent f5e2154 commit 227ffcd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sql/item.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2881,7 +2881,7 @@ void Item_ident::print(const THD *thd, String *str, enum_query_type query_type,
28812881
return;
28822882
}
28832883

2884-
if (db_name_arg && db_name_arg[0] && !(query_type & QT_NO_DB) &&
2884+
if (!(query_type & QT_NO_DB) && db_name_arg && db_name_arg[0] &&
28852885
!alias_name_used()) {
28862886
const size_t d_name_len = strlen(d_name);
28872887
if (!((query_type & QT_NO_DEFAULT_DB) &&
@@ -2890,7 +2890,7 @@ void Item_ident::print(const THD *thd, String *str, enum_query_type query_type,
28902890
str->append('.');
28912891
}
28922892
}
2893-
if (table_name_arg[0] && !(query_type & QT_NO_TABLE)) {
2893+
if (!(query_type & QT_NO_TABLE) && table_name_arg[0]) {
28942894
append_identifier(thd, str, t_name, strlen(t_name));
28952895
str->append('.');
28962896
}

0 commit comments

Comments
 (0)