[MDEV-33283] Binlog Checksum is Zeroed by Zlib if Part of Event Data is Empty Created: 2024-01-19 Updated: 2024-01-22 Resolved: 2024-01-22 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Replication |
| Affects Version/s: | 10.4, 10.5, 10.6, 10.11, 11.0, 11.1, 11.2, 11.3 |
| Fix Version/s: | 10.5.24, 10.6.17, 10.11.7, 11.0.5, 11.1.4, 11.2.3 |
| Type: | Bug | Priority: | Blocker |
| Reporter: | Brandon Nesterenko | Assignee: | Brandon Nesterenko |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
An existing binlog checksum can be overridden to 0 if writing a NULL payload when using Zlib for the computation. That is, calling into Zlib's crc32 with empty data initializes an incremental CRC computation to 0; from their documentation:
Looking into the binary logging code, we see that the checksum is computed as long as there is an existing checksum length:
Even if there is no payload to actually write. Conversely, in the actual encrypt_or_write function, we exit early if there is nothing to write.
This pattern should be extended into the write_data() to not (re)-compute the checksum if there is nothing to write. |
| Comments |
| Comment by Brandon Nesterenko [ 2024-01-22 ] |
|
Hi Elkin! This is ready for review: PR-3016 |
| Comment by Andrei Elkin [ 2024-01-22 ] |
|
The GH PR is approved. I believe we also need to report a ticket on incompatible behaviour of the maria's and Zlib functions and assign one to Serg. |
| Comment by Brandon Nesterenko [ 2024-01-22 ] |
|
Pushed into 10.5 as 207c85783b2. |