Hi, Hackers. bloom_create() currently accepts a zero total_elems estimate. This causes optimal_k() to divide by zero and then convert infinity to int, which is undefined behavior.
The attached patch rejects nonpositive estimates before the calculation. It also performs the bitset size multiplication as unsigned arithmetic to avoid signed overflow for very large positive estimates, and adds a regression test for the zero case. The affected source and test module compile successfully, and git diff --check passes. Regards, DaeMyung Kang
v1-0001-Reject-nonpositive-Bloom-filter-element-estimates.patch
Description: Binary data
