Commit a204ce27 authored by Kristian Nielsen's avatar Kristian Nielsen

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: default avatarKristian Nielsen <knielsen@knielsen-hq.org>
parent be694384
......@@ -182,6 +182,13 @@ BINLOG_GTID_POS('master-bin.000001',18446744073709551616)
NULL
Warnings:
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 ***
connection server_2;
include/sync_with_master_gtid.inc
......
......@@ -182,6 +182,13 @@ BINLOG_GTID_POS('master-bin.000001',18446744073709551616)
NULL
Warnings:
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 ***
connection server_2;
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',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 ***
--connection server_2
......
......@@ -3232,12 +3232,12 @@ String *Item_func_binlog_gtid_pos::val_str(String *str)
String name_str, *name;
longlong pos;
if (args[0]->null_value || args[1]->null_value)
goto err;
name= args[0]->val_str(&name_str);
pos= args[1]->val_int();
if (args[0]->null_value || args[1]->null_value)
goto err;
if (pos < 0 || pos > UINT_MAX32)
goto err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment