Uploaded image for project: 'MariaDB Connector/C'
  1. MariaDB Connector/C
  2. CONC-535

mariadb_rpl_fetch strips 4 bytes from the SQL when server binlog_checksum is off

    XMLWordPrintable

    Details

      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));
      

        Attachments

          Activity

            People

            Assignee:
            georg Georg Richter
            Reporter:
            rustyx Ruslan Altynbaev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Git Integration