fix segfault that could be caused by merging an empty bloom-filter

with a bloom-filter already containing values.

I assume that it is ok to merge an empty bloom-filter with any bloom-filter -
if not we have to change the patch to return an error in this case.
This commit is contained in:
Bernhard Amann 2013-07-30 16:10:06 -07:00
parent af9e181731
commit edb04e6d8b
4 changed files with 14 additions and 2 deletions

View file

@ -17,6 +17,7 @@ error: false-positive rate must take value between 0 and 1
1
1
1
1
2
3
3

View file

@ -45,6 +45,11 @@ function test_basic_bloom_filter()
print bloomfilter_lookup(bf_merged, 84);
print bloomfilter_lookup(bf_merged, 100);
print bloomfilter_lookup(bf_merged, 168);
#empty filter tests
local bf_empty = bloomfilter_basic_init(0.1, 1000);
local bf_empty_merged = bloomfilter_merge(bf_merged, bf_empty);
print bloomfilter_lookup(bf_empty_merged, 42);
}
function test_counting_bloom_filter()