浏览代码

Merge pull request #349 from svagner/patch-1

Fix number reads bytes for mysql 5.6
Julien Schmidt 10 年之前
父节点
当前提交
6d2067fccb
共有 2 个文件被更改,包括 5 次插入0 次删除
  1. 1 0
      AUTHORS
  2. 4 0
      utils.go

+ 1 - 0
AUTHORS

@@ -35,6 +35,7 @@ Runrioter Wung <runrioter at gmail.com>
 Soroush Pour <me at soroushjp.com>
 Xiaobing Jiang <s7v7nislands at gmail.com>
 Xiuming Chen <cc at cxm.cc>
+Stan Putrya <root.vagner at gmail.com>
 
 # Organizations
 

+ 4 - 0
utils.go

@@ -777,6 +777,10 @@ 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) {
+	// See issue #349
+	if len(b) == 0 {
+		return 0, true, 1
+	}
 	switch b[0] {
 
 	// 251: NULL