Skip to content

Commit 82e997a

Browse files
committed
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.
1 parent 276e042 commit 82e997a

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

mysql-test/main/xa.result

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,3 +369,8 @@ XA PREPARE 'Я_упaлa_c_сеновала_тормозила_головой';
369369
XA ROLLBACK 'Я_упaлa_c_сеновала_тормозила_головой';
370370
SET NAMES default;
371371
DROP TABLE t1;
372+
#
373+
# MDEV-21856 - xid_t::formatID has to be constrained to 4 byte size
374+
#
375+
XA START 'gtrid', 'bqual', 0x80000000;
376+
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

mysql-test/main/xa.test

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,4 +506,11 @@ SET NAMES default;
506506

507507
DROP TABLE t1;
508508

509+
510+
--echo #
511+
--echo # MDEV-21856 - xid_t::formatID has to be constrained to 4 byte size
512+
--echo #
513+
--error ER_PARSE_ERROR
514+
XA START 'gtrid', 'bqual', 0x80000000;
515+
509516
--source include/wait_until_count_sessions.inc

sql/sql_yacc.yy

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17553,7 +17553,9 @@ xid:
1755317553
}
1755417554
| text_string ',' text_string ',' ulong_num
1755517555
{
17556-
MYSQL_YYABORT_UNLESS($1->length() <= MAXGTRIDSIZE && $3->length() <= MAXBQUALSIZE);
17556+
MYSQL_YYABORT_UNLESS($1->length() <= MAXGTRIDSIZE &&
17557+
$3->length() <= MAXBQUALSIZE &&
17558+
$5 <= INT32_MAX);
1755717559
if (unlikely(!(Lex->xid=(XID *)thd->alloc(sizeof(XID)))))
1755817560
MYSQL_YYABORT;
1755917561
Lex->xid->set($5, $1->ptr(), $1->length(), $3->ptr(), $3->length());

0 commit comments

Comments
 (0)