OldPanda / bloomfilter

Yet another Bloomfilter implementation in Go, compatible with Java's Guava library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

runtime issue with garbage bloomfilter values

eodria opened this issue · comments

this library will crash and fail if one creates a garbage bloomfilter value

this is the byte array i used: [1,1]

and this is the error i see

panic: runtime error: index out of range [3] with length 0
goroutine 223 [running]:
encoding/binary.bigEndian.Uint32(...)
/usr/local/go/src/encoding/binary/binary.go:112
github.com/OldPanda/bloomfilter.FromBytes(0xc000132170, 0x2, 0x8, 0x1, 0x1, 0x10)
/Users/odria/go/pkg/mod/github.com/!old!panda/bloomfilter@v0.1.1/bloomfilter.go:83 +0x613
main.isAcctAffiliated(0xc00081e0c0, 0x20, 0xc0006d41f8, 0x11, 0xc000430058, 0x8, 0x0)
/Users/odria/dev/github/SAFE-ya-query-engine.v2/src/qe_succ_acct.go:65 +0x545
main.SummarizePage(0xc00025c000, 0x400a125, 0xc000803e00, 0x4, 0x4895bd0)
/Users/odria/dev/github/SAFE-ya-query-engine.v2/src/qe_page_summary.go:293 +0x709
main.FetchHourlyFeatures(0xc00025c000, 0x4044316, 0x480e9f0, 0xc00009d620)
/Users/odria/dev/github/SAFE-ya-query-engine.v2/src/qe_main.go:275 +0x45
main.FetchFeatures.func1(0xc0004300c0, 0xc00025c000, 0xc0005ae020, 0xc000314080, 0xc0005ae040)
/Users/odria/dev/github/SAFE-ya-query-engine.v2/src/qe_main.go:195 +0x57
created by main.FetchFeatures
/Users/odria/dev/github/SAFE-ya-query-engine.v2/src/qe_main.go:191 +0x16

@eodria Thanks for raising the error here. I pushed a fix for possible garbage bytes input. Please upgrade to the latest version and verify if this is still an issue. Thanks!