New Upstream Release - golang-github-seiflotfy-cuckoofilter
Ready changes
Summary
Merged new upstream version: 0.0~git20220411.e3b120b (was: 0.0~git20201222.bc60055).
Resulting package
Built on 2022-12-14T03:22 (took 3m30s)
The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:
apt install -t fresh-releases golang-github-seiflotfy-cuckoofilter-dev
Lintian Result
- golang-github-seiflotfy-cuckoofilter-dev_0.0~git20220411.e3b120b-1~jan+nur1_all.deb
- golang-github-seiflotfy-cuckoofilter_0.0~git20220411.e3b120b-1~jan+nur1.dsc
- golang-github-seiflotfy-cuckoofilter_0.0~git20220411.e3b120b-1~jan+nur1_amd64.buildinfo
- golang-github-seiflotfy-cuckoofilter_0.0~git20220411.e3b120b-1~jan+nur1_amd64.changes
Diff
diff --git a/README.md b/README.md
index 8da9d3f..2a77fb3 100644
--- a/README.md
+++ b/README.md
@@ -30,7 +30,7 @@ With the 8 bit fingerprint size in this repository, you can expect `r ~= 0.03`.
package main
import "fmt"
-import "github.com/seiflotfy/cuckoofilter"
+import cuckoo "github.com/seiflotfy/cuckoofilter"
func main() {
cf := cuckoo.NewFilter(1000)
diff --git a/cuckoofilter.go b/cuckoofilter.go
index 2ce3fae..ec0d246 100644
--- a/cuckoofilter.go
+++ b/cuckoofilter.go
@@ -144,6 +144,9 @@ func Decode(bytes []byte) (*Filter, error) {
if len(bytes)%bucketSize != 0 {
return nil, fmt.Errorf("expected bytes to be multiple of %d, got %d", bucketSize, len(bytes))
}
+ if len(bytes) == 0 {
+ return nil, fmt.Errorf("bytes can not be empty")
+ }
buckets := make([]bucket, len(bytes)/4)
for i, b := range buckets {
for j := range b {
diff --git a/cuckoofilter_test.go b/cuckoofilter_test.go
index 82f658c..41eb12b 100644
--- a/cuckoofilter_test.go
+++ b/cuckoofilter_test.go
@@ -59,6 +59,16 @@ func TestEncodeDecode(t *testing.T) {
}
}
+func TestDecode(t *testing.T) {
+ ncf, err := Decode([]byte(""))
+ if err == nil {
+ t.Errorf("Expected err, got nil")
+ }
+ if ncf != nil {
+ t.Errorf("Expected nil, got %v", ncf)
+ }
+}
+
func BenchmarkFilter_Reset(b *testing.B) {
const cap = 10000
filter := NewFilter(cap)
diff --git a/debian/changelog b/debian/changelog
index 13c8882..19fda3e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+golang-github-seiflotfy-cuckoofilter (0.0~git20220411.e3b120b-1) UNRELEASED; urgency=low
+
+ * New upstream snapshot.
+
+ -- Debian Janitor <janitor@jelmer.uk> Wed, 14 Dec 2022 03:19:38 -0000
+
golang-github-seiflotfy-cuckoofilter (0.0~git20201222.bc60055-2) unstable; urgency=medium
* debian/control:
Debdiff
File lists identical (after any substitutions)
No differences were encountered in the control files