[CONJ-1145] Wrong sequence number of sub header with compressing procotol active Created: 2024-01-04 Updated: 2024-01-12 Resolved: 2024-01-12 |
|
| Status: | Closed |
| Project: | MariaDB Connector/J |
| Component/s: | protocol |
| Affects Version/s: | 2.7.11 |
| Fix Version/s: | 2.7.12 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Zhe Huang | Assignee: | Diego Dupin |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
MariaDB Java Connector 2.X |
||
| Attachments: |
|
| Description |
|
MariaDB Java Connecter 2.X may generate wrong sequence number for the sub header. It can be reproduced by the following code:
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. |
| Comments |
| Comment by Zhe Huang [ 2024-01-04 ] |
|
The problem comes from the CompressPacketOutputStream.java. I used version 2.7.11 source code here. In line 163, the sub header has been generated. Here the sequence number got increased. Then, the compress length is so high that it does not pass the ratio(0.9) check in line 171. The process continues and it got increased again in line 278, leads th the 01 sequence number. |
| Comment by Zhe Huang [ 2024-01-05 ] |
|
Also I have submitted the pull request here: https://github.com/mariadb-corporation/mariadb-connector-j/pull/191 |
| Comment by Diego Dupin [ 2024-01-12 ] |
|
confirmed. This concerns only 2.x version. |