Skip to content

Commit 677c44f

Browse files
committed
MDEV-10775 System table in InnoDB format allowed in MariaDB could lead to crash
when opening a system table for a SELECT-like read, pretend (for the sake of engines) it's SQLCOM_SELECT
1 parent e56a539 commit 677c44f

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
alter table mysql.time_zone_name engine=InnoDB;
2+
create table envois3 (starttime datetime) engine=InnoDB;
3+
insert envois3 values ('2008-08-11 22:43:00');
4+
select convert_tz(starttime,'UTC','Europe/Moscow') starttime from envois3;
5+
starttime
6+
2008-08-12 02:43:00
7+
drop table envois3;
8+
alter table mysql.time_zone_name engine=MyISAM;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--source include/have_innodb.inc
2+
3+
#
4+
# MDEV-10775 System table in InnoDB format allowed in MariaDB could lead to crash
5+
#
6+
alter table mysql.time_zone_name engine=InnoDB;
7+
create table envois3 (starttime datetime) engine=InnoDB;
8+
insert envois3 values ('2008-08-11 22:43:00');
9+
--source include/restart_mysqld.inc
10+
select convert_tz(starttime,'UTC','Europe/Moscow') starttime from envois3;
11+
drop table envois3;
12+
alter table mysql.time_zone_name engine=MyISAM;

sql/sql_base.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9223,6 +9223,7 @@ open_system_tables_for_read(THD *thd, TABLE_LIST *table_list,
92239223
*/
92249224
lex->reset_n_backup_query_tables_list(&query_tables_list_backup);
92259225
thd->reset_n_backup_open_tables_state(backup);
9226+
thd->lex->sql_command= SQLCOM_SELECT;
92269227

92279228
if (open_and_lock_tables(thd, table_list, FALSE,
92289229
MYSQL_OPEN_IGNORE_FLUSH |

0 commit comments

Comments
 (0)