Skip to content

Commit dc74d23

Browse files
MDEV-27184 Assertion (old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed, Assertion str.alloced_length() >= str.length() + data_len' failed
Spider crashes on a query that inserts some rows including float. This is because Spider allocates a string of insufficient length.
1 parent 3c1cde8 commit dc74d23

File tree

4 files changed

+55
-1
lines changed

4 files changed

+55
-1
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#
2+
# MDEV-27184 Assertion `(old_top == initial_top (av) && old_size == 0) ||
3+
# ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) &&
4+
# ((unsigned long) old_end & (pagesize - 1)) == 0)' failed,
5+
# Assertion `str.alloced_length() >= str.length() + data_len' failed
6+
#
7+
for master_1
8+
for child2
9+
for child3
10+
connection master_1;
11+
CREATE DATABASE auto_test_remote;
12+
USE auto_test_remote;
13+
CREATE TABLE tbl_a (a FLOAT) ENGINE=SPIDER;
14+
INSERT INTO tbl_a VALUES
15+
(0xF5A7),(0xF5A8),(0xF5A9),(0xF5AA),(0xF5AB),(0xF5AC),(0xF5AD),(0xF5AE),
16+
(0xF5A7),(0xF5A8),(0xF5A9),(0xF5AA),(0xF5AB),(0xF5AC),(0xF5AD),(0xF5AE);
17+
ERROR HY000: Unable to connect to foreign data source: localhost
18+
DROP DATABASE auto_test_remote;
19+
for master_1
20+
for child2
21+
for child3
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
!include include/default_mysqld.cnf
2+
!include ../my_1_1.cnf
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
--echo #
2+
--echo # MDEV-27184 Assertion `(old_top == initial_top (av) && old_size == 0) ||
3+
--echo # ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) &&
4+
--echo # ((unsigned long) old_end & (pagesize - 1)) == 0)' failed,
5+
--echo # Assertion `str.alloced_length() >= str.length() + data_len' failed
6+
--echo #
7+
8+
--disable_query_log
9+
--disable_result_log
10+
--source ../../t/test_init.inc
11+
--enable_result_log
12+
--enable_query_log
13+
14+
--connection master_1
15+
CREATE DATABASE auto_test_remote;
16+
USE auto_test_remote;
17+
18+
CREATE TABLE tbl_a (a FLOAT) ENGINE=SPIDER;
19+
20+
--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE
21+
INSERT INTO tbl_a VALUES
22+
(0xF5A7),(0xF5A8),(0xF5A9),(0xF5AA),(0xF5AB),(0xF5AC),(0xF5AD),(0xF5AE),
23+
(0xF5A7),(0xF5A8),(0xF5A9),(0xF5AA),(0xF5AB),(0xF5AC),(0xF5AD),(0xF5AE);
24+
25+
DROP DATABASE auto_test_remote;
26+
27+
--disable_query_log
28+
--disable_result_log
29+
--source ../../t/test_deinit.inc
30+
--enable_result_log
31+
--enable_query_log

storage/spider/spd_db_mysql.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4388,7 +4388,7 @@ int spider_db_mariadb_util::append_column_value(
43884388
} else if (float_value)
43894389
{
43904390
if (str->reserve(SPIDER_SQL_CAST_LEN + ptr->length() +
4391-
SPIDER_SQL_AS_FLOAT_LEN, SPIDER_SQL_CLOSE_PAREN_LEN))
4391+
SPIDER_SQL_AS_FLOAT_LEN + SPIDER_SQL_CLOSE_PAREN_LEN))
43924392
{
43934393
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
43944394
}

0 commit comments

Comments
 (0)