From f0de349575ca7c30f05a6840f8bba18c6b95ca83 Mon Sep 17 00:00:00 2001 From: ENDOH takanao Date: Fri, 20 Sep 2019 12:05:54 +0900 Subject: [PATCH] Workaround for Linux 32-bit build --- db.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/db.go b/db.go index 3b33cd7a..9a88a4d4 100755 --- a/db.go +++ b/db.go @@ -216,7 +216,10 @@ func ListColumnFamilies(opts *Options, name string) ([]string, error) { } namesLen := int(cLen) names := make([]string, namesLen) - cNamesArr := (*[1 << 30]*C.char)(unsafe.Pointer(cNames))[:namesLen:namesLen] + // The maximum capacity of the following two slices is limited to (2^29)-1 to remain compatible + // with 32-bit platforms. The size of a `*C.char` (a pointer) is 4 Byte on a 32-bit system + // and (2^29)*4 == math.MaxInt32 + 1. -- See issue golang/go#13656 + cNamesArr := (*[(1 << 29) - 1]*C.char)(unsafe.Pointer(cNames))[:namesLen:namesLen] for i, n := range cNamesArr { names[i] = C.GoString(n) }