-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDEV-29644 a potential bug of null pointer dereference in spider_db_m…
…base::print_warnings() The function spider_db_mbase::print_warnings() can potentially result in a null pointer dereference. Remove the null pointer dereference by cleaning up the function.
- Loading branch information
1 parent
2b89598
commit be0a46b
Showing
5 changed files
with
141 additions
and
56 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
storage/spider/mysql-test/spider/bugfix/r/mdev_29644.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# | ||
# MDEV-29644 a potential bug of null pointer dereference in spider_db_mbase::print_warnings() | ||
# | ||
for master_1 | ||
for child2 | ||
child2_1 | ||
child2_2 | ||
child2_3 | ||
for child3 | ||
connection child2_1; | ||
CREATE DATABASE auto_test_remote; | ||
USE auto_test_remote; | ||
CREATE TABLE tbl_a ( | ||
a CHAR(5) | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | ||
set @orig_sql_mode=@@global.sql_mode; | ||
SET GLOBAL sql_mode=''; | ||
connection master_1; | ||
CREATE DATABASE auto_test_local; | ||
USE auto_test_local; | ||
CREATE TABLE tbl_a ( | ||
a CHAR(255) | ||
) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", srv "s_2_1"'; | ||
SET @orig_sql_mode=@@global.sql_mode; | ||
SET GLOBAL sql_mode=''; | ||
INSERT INTO tbl_a VALUES ("this will be truncated"); | ||
NOT FOUND /\[WARN SPIDER RESULT\].* Warning 1265 Data truncated for column 'a' at row 1.*/ in mysqld.1.1.err | ||
SET @orig_log_result_errors=@@global.spider_log_result_errors; | ||
SET GLOBAL spider_log_result_errors=4; | ||
INSERT INTO tbl_a VALUES ("this will be truncated"); | ||
FOUND 1 /\[WARN SPIDER RESULT\].* Warning 1265 Data truncated for column 'a' at row 1.*/ in mysqld.1.1.err | ||
connection master_1; | ||
SET GLOBAL spider_log_result_errors=@orig_log_result_errors; | ||
SET GLOBAL sql_mode=@orig_sql_mode; | ||
DROP DATABASE IF EXISTS auto_test_local; | ||
connection child2_1; | ||
SET GLOBAL sql_mode=@orig_sql_mode; | ||
DROP DATABASE IF EXISTS auto_test_remote; | ||
for master_1 | ||
for child2 | ||
child2_1 | ||
child2_2 | ||
child2_3 | ||
for child3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
!include include/default_mysqld.cnf | ||
!include ../my_1_1.cnf | ||
!include ../my_2_1.cnf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
--echo # | ||
--echo # MDEV-29644 a potential bug of null pointer dereference in spider_db_mbase::print_warnings() | ||
--echo # | ||
|
||
# The test case below does not cause the potential null pointer dereference. | ||
# It is just for checking spider_db_mbase::fetch_and_print_warnings() works. | ||
|
||
--disable_query_log | ||
--disable_result_log | ||
--source ../../t/test_init.inc | ||
--enable_result_log | ||
--enable_query_log | ||
|
||
--connection child2_1 | ||
CREATE DATABASE auto_test_remote; | ||
USE auto_test_remote; | ||
eval CREATE TABLE tbl_a ( | ||
a CHAR(5) | ||
) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; | ||
set @orig_sql_mode=@@global.sql_mode; | ||
SET GLOBAL sql_mode=''; | ||
|
||
--connection master_1 | ||
CREATE DATABASE auto_test_local; | ||
USE auto_test_local; | ||
eval CREATE TABLE tbl_a ( | ||
a CHAR(255) | ||
) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='table "tbl_a", srv "s_2_1"'; | ||
|
||
SET @orig_sql_mode=@@global.sql_mode; | ||
SET GLOBAL sql_mode=''; | ||
|
||
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.1.err; | ||
let SEARCH_PATTERN= \[WARN SPIDER RESULT\].* Warning 1265 Data truncated for column 'a' at row 1.*; | ||
|
||
INSERT INTO tbl_a VALUES ("this will be truncated"); | ||
--source include/search_pattern_in_file.inc # should not find | ||
|
||
SET @orig_log_result_errors=@@global.spider_log_result_errors; | ||
SET GLOBAL spider_log_result_errors=4; | ||
|
||
INSERT INTO tbl_a VALUES ("this will be truncated"); | ||
--source include/search_pattern_in_file.inc # should find | ||
|
||
--connection master_1 | ||
SET GLOBAL spider_log_result_errors=@orig_log_result_errors; | ||
SET GLOBAL sql_mode=@orig_sql_mode; | ||
DROP DATABASE IF EXISTS auto_test_local; | ||
|
||
--connection child2_1 | ||
SET GLOBAL sql_mode=@orig_sql_mode; | ||
DROP DATABASE IF EXISTS auto_test_remote; | ||
|
||
--disable_query_log | ||
--disable_result_log | ||
--source ../t/test_deinit.inc | ||
--enable_query_log | ||
--enable_result_log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters