Bug #121953 CHANGE REPLICATION SOURCE narrows invalid large applier option values

Submitted: 27 Nov 3:16
Reporter: QiFan Liu Email Updates:
Status: Open Impact on me:
None 
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:26.10.0 OS:Linux
Assigned to: CPU Architecture:x86
Tags: APPLIER_VERSION, APPLIER_WORKER_COUNT, CHANGE REPLICATION SOURCE

[27 Nov 3:16] QiFan Liu
Description:
CHANGE REPLICATION SOURCE accepts out-of-range applier option values after narrowing them to 32 bits.

The MySQL 26.10 Reference Manual documents APPLIER_VERSION = {1|2}. However, APPLIER_VERSION=4294967297 is accepted and stored as 1:

ORACLE_RESULT	OBSERVED_APPLIER_VERSION
INVALID_VERSION_ACCEPTED	1

The same problem affects APPLIER_WORKER_COUNT, whose documented range is 1 through 1024. APPLIER_WORKER_COUNT=4294967297 is accepted and stored as 1:

ORACLE_RESULT	OBSERVED_WORKER_COUNT
INVALID_COUNT_ACCEPTED	1

Both values should be rejected because 4294967297 is outside their documented domains.

How to repeat:
Run as root:

CHANGE REPLICATION SOURCE TO SOURCE_HOST='127.0.0.1'
  FOR CHANNEL 'ch_version';

CHANGE REPLICATION SOURCE TO APPLIER_VERSION=4294967297
  FOR CHANNEL 'ch_version';

SELECT 'INVALID_VERSION_ACCEPTED' AS ORACLE_RESULT,
       APPLIER_VERSION AS OBSERVED_APPLIER_VERSION
FROM performance_schema.replication_applier_configuration
WHERE CHANNEL_NAME='ch_version';
-- Returns INVALID_VERSION_ACCEPTED, 1; expected the preceding CHANGE statement to fail.

CHANGE REPLICATION SOURCE TO
  SOURCE_HOST='127.0.0.1', SOURCE_AUTO_POSITION=1, GTID_ONLY=1,
  REQUIRE_ROW_FORMAT=1, APPLIER_VERSION=2, APPLIER_WORKER_COUNT=1
  FOR CHANNEL 'ch_workers';

CHANGE REPLICATION SOURCE TO APPLIER_WORKER_COUNT=4294967297
  FOR CHANNEL 'ch_workers';

SELECT 'INVALID_COUNT_ACCEPTED' AS ORACLE_RESULT,
       APPLIER_WORKER_COUNT AS OBSERVED_WORKER_COUNT
FROM performance_schema.replication_applier_configuration
WHERE CHANNEL_NAME='ch_workers';
-- Returns INVALID_COUNT_ACCEPTED, 1; expected the preceding CHANGE statement to fail.

RESET REPLICA ALL FOR CHANNEL 'ch_version';
RESET REPLICA ALL FOR CHANNEL 'ch_workers';

Suggested fix:
Validate the parsed values against their documented ranges before converting them to the narrower fields.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.049 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.