Bug #109401 | Rows_query_log_event truncates query due to treating query as C string | ||
---|---|---|---|
Submitted: | 16 Dec 2022 2:01 | Modified: | 27 Aug 2024 15:37 |
Reporter: | Jeremy Cole (Basic Quality Contributor) (OCA) | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Row Based Replication ( RBR ) | Severity: | S3 (Non-critical) |
Version: | 8.0.31, 5.7.40, 8.0.33 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | binlog, binlog_rows_query_log_events, RBR |
[16 Dec 2022 2:01]
Jeremy Cole
[16 Dec 2022 10:52]
MySQL Verification Team
Hello Jeremy, Thank you for the report and feedback. Sincerely, Umesh
[27 Aug 2024 15:37]
Jon Stephens
Documented fix as follows in the MySQL 9.0.0 changelog: When using row-based replication with binlog_rows_query_log_events enabled, SQL statements are logged in a Rows_query_log_event which is written before the Table_map_event. Since SQL may contain any binary data including embedded nulls (\0), using the C strlen() and snprintf() and other similar functions which rely on processing up to the null byte, it was possible for the query string to be truncated at the first null byte, which resulted in processing incomplete data. We fix this by specifying the length of each Rows_query_log_event such that it is no longer necessary to rely on C style string methods for length calculations; in addition, while processing the query, we now use functions which do not rely on null termination. We also mark the first byte of a Rows_query_log_event data body as unused. Closed.