prime icon indicating copy to clipboard operation
prime copied to clipboard

`csegPool` uses a stale `segSize` when we call `prime.Primes()` for increasing values

Open corywalker opened this issue 1 year ago • 0 comments

There is a bug in prime.Primes() where the csegPool uses a stale segSize when we call the function for increasing values, causing a panic. For example, calling prime.Primes(15) then prime.Primes(19) will trigger a panic.

Lines with the bug: https://github.com/kavehmz/prime/blob/a94ad56341db886ae3346de1e6b341387c3c01d3/prime.go#L110-L112

Reproduced the issue at: https://github.com/corywalker/prime/commit/efd80a4fe9efd7263b329006629855d6f73c1c2e

corywalker avatar Sep 08 '24 05:09 corywalker