Details
-
Bug
-
Status: Closed (View Workflow)
-
Blocker
-
Resolution: Fixed
-
10.4(EOL), 10.5, 10.6, 10.11, 11.0(EOL), 11.1(EOL), 11.2(EOL), 11.3(EOL)
-
None
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:
If buf is Z_NULL, this function returns the required initial value for the crc.
Looking into the binary logging code, we see that the checksum is computed as long as there is an existing checksum length:
int Log_event_writer::write_data(const uchar *pos, size_t len)
|
{
|
DBUG_ENTER("Log_event_writer::write_data");
|
if (checksum_len)
|
crc= my_checksum(crc, pos, len);
|
 |
DBUG_RETURN((this->*encrypt_or_write)(pos, len));
|
}
|
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.
int Log_event_writer::encrypt_and_write(const uchar *pos, size_t len)
|
{
|
...
|
if (!len)
|
return 0;
|
This pattern should be extended into the write_data() to not (re)-compute the checksum if there is nothing to write.
Attachments
Issue Links
- split from
-
MDEV-27666 User variable not parsed as geometry variable in geometry function
- Closed