diff options
author | timothy <timothy@luno.com> | 2018-05-02 01:00:12 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2018-05-02 15:34:31 +0800 |
commit | a1949d0788ecb1d890677bdd26c0e711ddf639b2 (patch) | |
tree | 9527c8654a0346b784203bfbd59ee2c728bf50ab /vendor/github.com/syndtr/goleveldb | |
parent | 9f6af6f812453f7ba30822606bb2a04ba8872ccb (diff) | |
download | go-tangerine-a1949d0788ecb1d890677bdd26c0e711ddf639b2.tar go-tangerine-a1949d0788ecb1d890677bdd26c0e711ddf639b2.tar.gz go-tangerine-a1949d0788ecb1d890677bdd26c0e711ddf639b2.tar.bz2 go-tangerine-a1949d0788ecb1d890677bdd26c0e711ddf639b2.tar.lz go-tangerine-a1949d0788ecb1d890677bdd26c0e711ddf639b2.tar.xz go-tangerine-a1949d0788ecb1d890677bdd26c0e711ddf639b2.tar.zst go-tangerine-a1949d0788ecb1d890677bdd26c0e711ddf639b2.zip |
vendor: fix leveldb crash when bigger than 1 TiB
Diffstat (limited to 'vendor/github.com/syndtr/goleveldb')
-rw-r--r-- | vendor/github.com/syndtr/goleveldb/leveldb/storage/mem_storage.go | 8 | ||||
-rw-r--r-- | vendor/github.com/syndtr/goleveldb/leveldb/util.go | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/vendor/github.com/syndtr/goleveldb/leveldb/storage/mem_storage.go b/vendor/github.com/syndtr/goleveldb/leveldb/storage/mem_storage.go index 9b0421f03..838f1bee1 100644 --- a/vendor/github.com/syndtr/goleveldb/leveldb/storage/mem_storage.go +++ b/vendor/github.com/syndtr/goleveldb/leveldb/storage/mem_storage.go @@ -12,7 +12,11 @@ import ( "sync" ) -const typeShift = 3 +const typeShift = 4 + +// Verify at compile-time that typeShift is large enough to cover all FileType +// values by confirming that 0 == 0. +var _ [0]struct{} = [TypeAll >> typeShift]struct{}{} type memStorageLock struct { ms *memStorage @@ -143,7 +147,7 @@ func (ms *memStorage) Remove(fd FileDesc) error { } func (ms *memStorage) Rename(oldfd, newfd FileDesc) error { - if FileDescOk(oldfd) || FileDescOk(newfd) { + if !FileDescOk(oldfd) || !FileDescOk(newfd) { return ErrInvalidFile } if oldfd == newfd { diff --git a/vendor/github.com/syndtr/goleveldb/leveldb/util.go b/vendor/github.com/syndtr/goleveldb/leveldb/util.go index e572a329e..0e2b519e5 100644 --- a/vendor/github.com/syndtr/goleveldb/leveldb/util.go +++ b/vendor/github.com/syndtr/goleveldb/leveldb/util.go @@ -20,7 +20,7 @@ func shorten(str string) string { return str[:3] + ".." + str[len(str)-3:] } -var bunits = [...]string{"", "Ki", "Mi", "Gi"} +var bunits = [...]string{"", "Ki", "Mi", "Gi", "Ti"} func shortenb(bytes int) string { i := 0 |