mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-33045: Server crashes in Item_func_binlog_gtid_pos::val_str / Binary_string::c_ptr_safe
Item::val_str() sets the Item::null_value flag, so call it before checking the flag, not after. Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
This commit is contained in:
@ -182,6 +182,13 @@ BINLOG_GTID_POS('master-bin.000001',18446744073709551616)
|
|||||||
NULL
|
NULL
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated
|
Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated
|
||||||
|
SET sql_log_bin= 0;
|
||||||
|
CREATE TABLE t1 AS SELECT MASTER_POS_WAIT(@binlog_file, 4, 0);
|
||||||
|
SELECT BINLOG_GTID_POS(@binlog_file, 4);
|
||||||
|
BINLOG_GTID_POS(@binlog_file, 4)
|
||||||
|
NULL
|
||||||
|
DROP TABLE t1;
|
||||||
|
SET sql_log_bin= 1;
|
||||||
*** Some tests of @@GLOBAL.gtid_binlog_state ***
|
*** Some tests of @@GLOBAL.gtid_binlog_state ***
|
||||||
connection server_2;
|
connection server_2;
|
||||||
include/sync_with_master_gtid.inc
|
include/sync_with_master_gtid.inc
|
||||||
|
@ -182,6 +182,13 @@ BINLOG_GTID_POS('master-bin.000001',18446744073709551616)
|
|||||||
NULL
|
NULL
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated
|
Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated
|
||||||
|
SET sql_log_bin= 0;
|
||||||
|
CREATE TABLE t1 AS SELECT MASTER_POS_WAIT(@binlog_file, 4, 0);
|
||||||
|
SELECT BINLOG_GTID_POS(@binlog_file, 4);
|
||||||
|
BINLOG_GTID_POS(@binlog_file, 4)
|
||||||
|
NULL
|
||||||
|
DROP TABLE t1;
|
||||||
|
SET sql_log_bin= 1;
|
||||||
*** Some tests of @@GLOBAL.gtid_binlog_state ***
|
*** Some tests of @@GLOBAL.gtid_binlog_state ***
|
||||||
connection server_2;
|
connection server_2;
|
||||||
include/sync_with_master_gtid.inc
|
include/sync_with_master_gtid.inc
|
||||||
|
@ -162,6 +162,13 @@ eval SELECT BINLOG_GTID_POS('$valid_binlog_name',0);
|
|||||||
eval SELECT BINLOG_GTID_POS('$valid_binlog_name',18446744073709551615);
|
eval SELECT BINLOG_GTID_POS('$valid_binlog_name',18446744073709551615);
|
||||||
eval SELECT BINLOG_GTID_POS('$valid_binlog_name',18446744073709551616);
|
eval SELECT BINLOG_GTID_POS('$valid_binlog_name',18446744073709551616);
|
||||||
|
|
||||||
|
# MDEV-33045: Server crashes in Item_func_binlog_gtid_pos::val_str / Binary_string::c_ptr_safe
|
||||||
|
SET sql_log_bin= 0;
|
||||||
|
CREATE TABLE t1 AS SELECT MASTER_POS_WAIT(@binlog_file, 4, 0);
|
||||||
|
SELECT BINLOG_GTID_POS(@binlog_file, 4);
|
||||||
|
DROP TABLE t1;
|
||||||
|
SET sql_log_bin= 1;
|
||||||
|
|
||||||
|
|
||||||
--echo *** Some tests of @@GLOBAL.gtid_binlog_state ***
|
--echo *** Some tests of @@GLOBAL.gtid_binlog_state ***
|
||||||
--connection server_2
|
--connection server_2
|
||||||
|
@ -3232,12 +3232,12 @@ String *Item_func_binlog_gtid_pos::val_str(String *str)
|
|||||||
String name_str, *name;
|
String name_str, *name;
|
||||||
longlong pos;
|
longlong pos;
|
||||||
|
|
||||||
if (args[0]->null_value || args[1]->null_value)
|
|
||||||
goto err;
|
|
||||||
|
|
||||||
name= args[0]->val_str(&name_str);
|
name= args[0]->val_str(&name_str);
|
||||||
pos= args[1]->val_int();
|
pos= args[1]->val_int();
|
||||||
|
|
||||||
|
if (args[0]->null_value || args[1]->null_value)
|
||||||
|
goto err;
|
||||||
|
|
||||||
if (pos < 0 || pos > UINT_MAX32)
|
if (pos < 0 || pos > UINT_MAX32)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user