Uploaded image for project: 'MariaDB Connector/J'
  1. MariaDB Connector/J
  2. CONJ-1145

Wrong sequence number of sub header with compressing procotol active

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • 2.7.11
    • 2.7.12
    • protocol
    • None
    • MariaDB Java Connector 2.X

    Description

      MariaDB Java Connecter 2.X may generate wrong sequence number for the sub header.

      It can be reproduced by the following code:

      import java.sql.*;
       
      public class Main {
          public static void main(String[] args) {
              String url = "jdbc:mariadb://127.0.0.1:4000/test?useCompression=True";
              String user = "root";
              String password = "";
       
              try {
                  Connection c = DriverManager.getConnection(url, user, password);
       
                  Statement s = c.createStatement();
       
                  String sql = "-- :: userIDaebcda5cb52dc741f20fe495327ddbfc8411cc53663eec3a5ffdb1f30626d39cc606822\nselect version();";
                  s.execute(sql);
                  s.close();
                  c.close();
       
              } catch (SQLException e) {
                  e.printStackTrace();
              }
       
          }
      }
      

      For version 2.X, it produces the following packet with sub header: 66 00 00 01

      And for version 3.X, the sub header looks like: 66 00 00 00

      The sequence number of sub header should be 0 in fact. Fortunately, MySQL / MariaDB don't take this number seriously and just skip the check process. Thus it can work as normal.

      However, for some other databases that follow MySQL protocol with a stricter sequence check, this would cause a problem.

      Attachments

        1. 2X.png
          2X.png
          254 kB
        2. 3X.png
          3X.png
          232 kB
        3. source.png
          source.png
          465 kB

        Activity

          People

            diego dupin Diego Dupin
            onlyacat Zhe Huang
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.