Преглед на файлове

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
Stanislav Putrya преди 10 години
родител
ревизия
9d0de8723f
променени са 1 файла, в които са добавени 3 реда и са изтрити 0 реда
  1. 3 0
      utils.go

+ 3 - 0
utils.go

@@ -777,6 +777,9 @@ func skipLengthEncodedString(b []byte) (int, error) {
 
 // returns the number read, whether the value is NULL and the number of bytes read
 func readLengthEncodedInteger(b []byte) (uint64, bool, int) {
+	if len(b) == 0 {
+		return 0, true, 1
+	}
 	switch b[0] {
 
 	// 251: NULL