Control: clone -1 -2
Control: reassign -2 golang-github-mattn-go-sqlite3 1.1.0~dfsg1-2
Control: retitle -2 sqlite3.go's bind func causes cgo pointer panic.

Hi,
I think this runtime panic is caused by library of mattn/go-sqlite3.
Debian package version of mattn/go-sqlite3 is v1.1.0 which released at
Sep 2015. it's before Go 1.6 release. Go 1.6 changed spec of cgo pointer.
Upstream Recent Version v1.2.0 is fixed this by this
commit(https://github.com/mattn/go-sqlite3/commit/b76c61051faaf0baf3215e6f811003d98639b702)

I attached a patch ported from this commit which fixed
golang-github-jinzhu-gorm's FTBFS on my local machine.

-- 
Haruki TSURUMOTO
PGP Fingerprint:3718 C84E 4EDA 1B5C 4F26 8639 9D3D EE3F 63A6 000E
This patch fixes cgo's pointer runtime panic
Ported from https://github.com/mattn/go-sqlite3/commit/b76c61051faaf0baf3215e6f811003d98639b702Index: golang-github-mattn-go-sqlite3-1.1.0~dfsg1/sqlite3.go
===================================================================
--- golang-github-mattn-go-sqlite3-1.1.0~dfsg1.orig/sqlite3.go	2015-09-05 23:49:54.000000000 +0900
+++ golang-github-mattn-go-sqlite3-1.1.0~dfsg1/sqlite3.go	2017-02-11 14:16:40.738620174 +0900
@@ -480,11 +480,11 @@
 		case float64:
 			rv = C.sqlite3_bind_double(s.s, n, C.double(v))
 		case []byte:
-			var p *byte
-			if len(v) > 0 {
-				p = &v[0]
+			if len(v) == 0 {
+				rv = C._sqlite3_bind_blob(s.s, n, nil, 0)
+			} else {
+				rv = C._sqlite3_bind_blob(s.s, n, unsafe.Pointer(&v[0]), C.int(len(v)))
 			}
-			rv = C._sqlite3_bind_blob(s.s, n, unsafe.Pointer(p), C.int(len(v)))
 		case time.Time:
 			b := []byte(v.UTC().Format(SQLiteTimestampFormats[0]))
 			rv = C._sqlite3_bind_text(s.s, n, (*C.char)(unsafe.Pointer(&b[0])), C.int(len(b)))

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to