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

rpl API parses MYSQL_TYPE_TIMESTAMP2 incorrectly

    XMLWordPrintable

Details

    Description

      mariadb_rpl_extract_rows() reads too many bytes from the event image for MYSQL_TYPE_TIMESTAMP2 values.

      mariadb_rpl.c

      MARIADB_RPL_ROW * STDCALL
      mariadb_rpl_extract_rows(MARIADB_RPL *rpl,
                               MARIADB_RPL_EVENT *tm_event,
                               MARIADB_RPL_EVENT *row_event)
      ...
              case MYSQL_TYPE_TIMESTAMP2:
              {
                char tmp[20];
                uint32_t p1= uint4korr(pos);
                uint8_t f_len= *metadata++;
                uint32_t p2;
                pos+= 4;
                p2= (uint32_t)uintNkorr(f_len, pos);
                pos+= f_len;
      

      Here it reads the metadata byte and then reads as many bytes from the event image.
      This differs from ma_rpl_get_second_part() that reads, for example, 3 bytes when the metadata byte says 5 or 6. This latter behavior matches what the server does:

      compat56.c

      uint my_timestamp_binary_length(uint dec)
      {
        DBUG_ASSERT(dec <= TIME_SECOND_PART_DIGITS);
        return 4 + (dec + 1) / 2;
      }
      

      This was reported by Asim Viladi Oglu Manizada

      Attachments

        Activity

          People

            georg Georg Richter
            serg Sergei Golubchik
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.