summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@mariadb.org>2020-03-09 18:31:18 +0400
committerSergey Vojtovich <svoj@mariadb.org>2020-03-09 18:31:18 +0400
commit82e997ad3f37fc87809d9074a40de0bb9200f232 (patch)
treece5a8f7569576b98ee741691c7da5bc3b52863cd
parent276e042de397b8ff38e1d72d8cfabd615fb3c490 (diff)
downloadmariadb-git-82e997ad3f37fc87809d9074a40de0bb9200f232.tar.gz
MDEV-21856 - xid_t::formatID has to be constrained to 4 byte size
Engine (InnoDB) and XA replication MDEV-742 requires the XID member be of a constant minimum across supported platform ulong size which is 4 bytes.
-rw-r--r--mysql-test/main/xa.result5
-rw-r--r--mysql-test/main/xa.test7
-rw-r--r--sql/sql_yacc.yy4
3 files changed, 15 insertions, 1 deletions
diff --git a/mysql-test/main/xa.result b/mysql-test/main/xa.result
index 030415a5320..f5d72930913 100644
--- a/mysql-test/main/xa.result
+++ b/mysql-test/main/xa.result
@@ -369,3 +369,8 @@ XA PREPARE 'Я_упaлa_c_сеновала_тормозила_головой';
XA ROLLBACK 'Я_упaлa_c_сеновала_тормозила_головой';
SET NAMES default;
DROP TABLE t1;
+#
+# MDEV-21856 - xid_t::formatID has to be constrained to 4 byte size
+#
+XA START 'gtrid', 'bqual', 0x80000000;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '0x80000000' at line 1
diff --git a/mysql-test/main/xa.test b/mysql-test/main/xa.test
index 41c1f5a8859..3305a54e690 100644
--- a/mysql-test/main/xa.test
+++ b/mysql-test/main/xa.test
@@ -506,4 +506,11 @@ SET NAMES default;
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-21856 - xid_t::formatID has to be constrained to 4 byte size
+--echo #
+--error ER_PARSE_ERROR
+XA START 'gtrid', 'bqual', 0x80000000;
+
--source include/wait_until_count_sessions.inc
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index b032ce66cc7..bb98e63e5c4 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -17553,7 +17553,9 @@ xid:
}
| text_string ',' text_string ',' ulong_num
{
- MYSQL_YYABORT_UNLESS($1->length() <= MAXGTRIDSIZE && $3->length() <= MAXBQUALSIZE);
+ MYSQL_YYABORT_UNLESS($1->length() <= MAXGTRIDSIZE &&
+ $3->length() <= MAXBQUALSIZE &&
+ $5 <= INT32_MAX);
if (unlikely(!(Lex->xid=(XID *)thd->alloc(sizeof(XID)))))
MYSQL_YYABORT;
Lex->xid->set($5, $1->ptr(), $1->length(), $3->ptr(), $3->length());