The binlog page size is currently fixed at 16k. Don't attempt to read using a different page size found in the file header, the code doesn't support it.
Signed-off-by: Kristian Nielsen <[email protected]> --- client/mysqlbinlog-engine.cc | 8 +++----- client/mysqlbinlog-engine.h | 1 + mysql-test/suite/binlog_in_engine/mysqlbinlog.result | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/client/mysqlbinlog-engine.cc b/client/mysqlbinlog-engine.cc index 8301669319a..cbcd8a01441 100644 --- a/client/mysqlbinlog-engine.cc +++ b/client/mysqlbinlog-engine.cc @@ -502,8 +502,6 @@ chunk_reader_mysqlbinlog::read_data(uchar *buffer, int max_len, bool multipage) else { size= std::min((uint32_t)max_len, s.chunk_len - s.chunk_read_offset); - if (s.in_page_offset + 3 + s.chunk_read_offset + size > binlog_page_size) - return read_error_corruption(s.file_no, s.page_no, "Invalid chunk read offset"); memcpy(buffer, page_buffer + s.in_page_offset + 3 + s.chunk_read_offset, size); buffer+= size; s.chunk_read_offset+= size; @@ -1063,12 +1061,12 @@ chunk_reader_mysqlbinlog::parse_file_header() error("Unsupported version of InnoDB binlog file, cannot read"); return -1; } - binlog_page_size= 1 << uint4korr(page_buffer + 4); - if (binlog_page_size > BINLOG_PAGE_SIZE_MAX) + if (BINLOG_PAGE_SIZE != ((uint32_t)1 << uint4korr(page_buffer + 4))) { - error("Too large binlog page size, cannot read"); + error("Invalid/unsupported page size in InnoDB binlog file, cannot read"); return -1; } + binlog_page_size= BINLOG_PAGE_SIZE; s.file_no= uint8korr(page_buffer + 16); return 0; } diff --git a/client/mysqlbinlog-engine.h b/client/mysqlbinlog-engine.h index 1438abeb480..dbc4a85a5b1 100644 --- a/client/mysqlbinlog-engine.h +++ b/client/mysqlbinlog-engine.h @@ -20,6 +20,7 @@ static constexpr uint32_t BINLOG_HEADER_PAGE_SIZE= 512; +static constexpr uint32_t BINLOG_PAGE_SIZE= ((uint32_t)1 << 14); extern const char *INNODB_BINLOG_MAGIC; extern handler_binlog_reader *get_binlog_reader_innodb(); diff --git a/mysql-test/suite/binlog_in_engine/mysqlbinlog.result b/mysql-test/suite/binlog_in_engine/mysqlbinlog.result index 2892696915d..f4d93d2e50f 100644 --- a/mysql-test/suite/binlog_in_engine/mysqlbinlog.result +++ b/mysql-test/suite/binlog_in_engine/mysqlbinlog.result @@ -108,5 +108,5 @@ DROP TABLE t1; /*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; -ERROR: Too large binlog page size, cannot read +ERROR: Invalid/unsupported page size in InnoDB binlog file, cannot read # End of 12.3 tests -- 2.47.3 _______________________________________________ commits mailing list -- [email protected] To unsubscribe send an email to [email protected]
