julien-duponchelle / python-mysql-replication

Pure Python Implementation of MySQL replication protocol build on top of PyMYSQL
2.31k stars 678 forks source link

Fix parsing of query field of RowsQueryEvent #602

Closed dongwook-chan closed 6 months ago

dongwook-chan commented 7 months ago

Description

The first byte of payload in RowsQueryEvent must be ignored without being used as the length for the following field query. Yet, the existing code did use this value as length for query and fails whenever parsing query longer than 255 characters which is the maximum value that a single byte can hold.

I fixed the bug referring to code from msql-server.

Other clients in different languages implement the RowsQueryEvent the way mysql-server does and noted below as references.

Type of Change

Checklist

Tests

Additional Information

avaitla commented 6 months ago

This also crashes for our MySQL 8.035. Would love to see it merged in. We are having to use: poetry add git+ssh://git@github.com:dongwook-chan/python-mysql-replication.git