MDEV-38020 Master & relay log info files read 2^31 and above incorrectly#4701
Open
FarihaIS wants to merge 1 commit intoMariaDB:10.6from
Open
MDEV-38020 Master & relay log info files read 2^31 and above incorrectly#4701FarihaIS wants to merge 1 commit intoMariaDB:10.6from
FarihaIS wants to merge 1 commit intoMariaDB:10.6from
Conversation
Master and relay log positions are 64-bit unsigned but were read using atoi(), which only handles signed 32-bit integers. Values >= 2^31 overflow and corrupt after restart. Add init_ullongvar_from_file() using my_strtoll10() to correctly parse 64-bit values. Update rpl_rli.cc and rpl_mi.cc to use ulonglong variables and this new function. All new code of the whole pull request, including one or several files that are either new files or modified ones, are contributed under the BSD-new license. I am contributing on behalf of my employer Amazon Web Services, Inc.
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Master and relay log position fields (
relay_log_pos,master_log_pos) are 64-bit unsigned (ulonglong) but were read from info files usinginit_intvar_from_file()which callsatoi(), limiting values to signed 32-bit integers.Add
init_ullongvar_from_file()usingmy_strtoll10()to correctly parse 64-bit values. Updaterpl_rli.ccandrpl_mi.ccto useulonglongvariables and this new function.Release Notes
N/A
How can this PR be tested?
Execute the
rpl.rpl_read_old_relay_log_infotest in mysql-test-run. This commit adds a test inrpl_read_old_relay_log_info.test.Before the fix
The test fails due to the
relay_log_posoverflowing and becoming corrupted after a server restart.After the fix
The test passes as the 64-bit value is correctly preserved across server restarts.
Basing the PR against the correct MariaDB version
Copyright
All new code of the whole pull request, including one or several files that are either new files or modified ones, are contributed under the BSD-new license. I am contributing on behalf of my employer Amazon Web Services, Inc.