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

@ -186,7 +186,10 @@ function bloomfilter_merge%(bf1: opaque of bloomfilter,
const BloomFilterVal* bfv1 = static_cast<const BloomFilterVal*>(bf1);
const BloomFilterVal* bfv2 = static_cast<const BloomFilterVal*>(bf2);
if ( ! same_type(bfv1->Type(), bfv2->Type()) )
if ( ( bfv1->Type() != bfv2->Type() ) && // both 0 is ok
(bfv1->Type() != 0) &&
(bfv2->Type() != 0) &&
! same_type(bfv1->Type(), bfv2->Type()) )
{
reporter->Error("incompatible Bloom filter types");
return 0;