[CONC-535] mariadb_rpl_fetch strips 4 bytes from the SQL when server binlog_checksum is off Created: 2021-03-19  Updated: 2021-06-14  Resolved: 2021-03-22

Status: Closed
Project: MariaDB Connector/C
Component/s: Replication/Binlog API
Affects Version/s: 3.1.12
Fix Version/s: 3.2.0, 3.1.13

Type: Bug Priority: Major
Reporter: Ruslan Altynbaev Assignee: Georg Richter
Resolution: Fixed Votes: 0
Labels: None


 Description   

When mariadb server has binlog_checksum=NONE, mariadb_rpl_fetch is still assuming there's a checksum at the end of the packet, and gives 4 bytes too short SQL in QUERY_EVENT and ANNOTATE_ROWS_EVENT.

It seems to be caused at line 238 in mariadb_rpl.c

      /* calculate statement size: buffer + buffer_size - current_ofs (ev) - crc_size */
      len= (size_t)(rpl->buffer + rpl->buffer_size - ev - 4);

Which should have been

      len= (size_t)(rpl->buffer + rpl->buffer_size - ev - (rpl->use_checksum ? 4 : 0));

And for ANNOTATE_ROWS_EVENT, at line 305:

      len= (uint32)(rpl->buffer + rpl->buffer_size - (unsigned char *)ev - 4);

which should be, similarly:

      len= (uint32)(rpl->buffer + rpl->buffer_size - (unsigned char *)ev - (rpl->use_checksum ? 4 : 0));



 Comments   
Comment by Georg Richter [ 2021-03-22 ]

Fixed in rev. d272377f897f0da3dc6d69f0c9050fd9ec8261bd

Generated at Thu Feb 08 03:06:01 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.