The type of nextCleanupBucket is int8, if the size is greater than int8, it will result in overflow causing negative numbers, ultimately leading to a program panic.
panic: runtime error: index out of range [-28]
goroutine 104 [running]:
github.com/scalalang2/golang-fifo/sieve.(*Sieve[...]).addToBucket(0xe3ae20, 0xc000496b90)
/home/laisky.cai/go/pkg/mod/github.com/scalalang2/golang-fifo@v1.0.0/sieve/sieve.go:250 +0x3a7
github.com/scalalang2/golang-fifo/sieve.(*Sieve[...]).Set(0xe3ae20, {0xc000346468, 0x8}, {0xc000346478, 0x8})
/home/laisky.cai/go/pkg/mod/github.com/scalalang2/golang-fifo@v1.0.0/sieve/sieve.go:117 +0xb91
The type of
nextCleanupBucket
isint8
, if thesize
is greater thanint8
, it will result in overflow causing negative numbers, ultimately leading to a program panic.