Skip to content

Commit 9d0de87

Browse files
committed
Fix number reads bytes fir mysql 5.6
There is fix situation then mysql return 0 bytes for NULL column. This situation can be called with run statement "show slave hosts" at mysql 5.6 with slave mysql 5.5. In this case we got panic: out of range
1 parent 66b7d5c commit 9d0de87

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

utils.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,9 @@ func skipLengthEncodedString(b []byte) (int, error) {
777777

778778
// returns the number read, whether the value is NULL and the number of bytes read
779779
func readLengthEncodedInteger(b []byte) (uint64, bool, int) {
780+
if len(b) == 0 {
781+
return 0, true, 1
782+
}
780783
switch b[0] {
781784

782785
// 251: NULL

0 commit comments

Comments
 (0)