From 3eafba8f1fa218c020ecd7408262a7469c95e008 Mon Sep 17 00:00:00 2001 From: David Crawshaw Date: Wed, 19 Dec 2018 14:04:32 -0500 Subject: [PATCH] sqlite: handle []byte larger than 1<<28 Requires a lttle care to do so while continuing to compile on 32-bit architectures. Fixes #45 --- sqlite.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/sqlite.go b/sqlite.go index 1978164..5ad7311 100644 --- a/sqlite.go +++ b/sqlite.go @@ -791,7 +791,17 @@ func (stmt *Stmt) columnBytes(col int) []byte { return nil } n := stmt.ColumnLen(col) - return (*[1 << 28]byte)(unsafe.Pointer(p))[:n:n] + + slice := struct { + data unsafe.Pointer + len int + cap int + }{ + data: unsafe.Pointer(p), + len: n, + cap: n, + } + return *(*[]byte)(unsafe.Pointer(&slice)) } // ColumnType are codes for each of the SQLite fundamental datatypes: