Skip to content

Commit a816aa0

Browse files
committed
Fixed ASAN heap-use-after-free handler::ha_index_or_rnd_end
MDEV-16123 ASAN heap-use-after-free handler::ha_index_or_rnd_end MDEV-13828 Segmentation fault on RENAME TABLE Problem was that destructor called methods for closed table. Fixed by removing code in destructor.
1 parent 908676d commit a816aa0

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CREATE TABLE t1 (i int);
2+
RENAME TABLE t1 TO t2;
3+
FLUSH TABLES;
4+
DROP TABLE IF EXISTS t1, t2;
5+
Warnings:
6+
Note 1051 Unknown table 'test.t1'

mysql-test/t/statistics_close.test

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#
2+
# MDEV-16123 ASAN heap-use-after-free handler::ha_index_or_rnd_end
3+
# MDEV-13828 Segmentation fault on RENAME TABLE
4+
#
5+
6+
CREATE TABLE t1 (i int);
7+
--connect (con1,localhost,root,,test)
8+
--send
9+
RENAME TABLE t1 TO t2;
10+
--connection default
11+
FLUSH TABLES;
12+
--connection con1
13+
--reap
14+
15+
# Cleanup
16+
--disconnect con1
17+
--connection default
18+
DROP TABLE IF EXISTS t1, t2;

sql/sql_statistics.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1376,7 +1376,8 @@ class Stat_table_write_iter
13761376

13771377
~Stat_table_write_iter()
13781378
{
1379-
cleanup();
1379+
/* Ensure that cleanup has been run */
1380+
DBUG_ASSERT(rowid_buf == 0);
13801381
}
13811382
};
13821383

0 commit comments

Comments
 (0)