Skip to content

uint64_t overflows cause false positives in _qf_multi_merge #13

@fazalmajid

Description

@fazalmajid

I was encountering spurious errors "Merging non compatible filters" in _qf_multi_merge with key_bits = 64 and quotient = 20 bits. I traced it to a 64-bit overflow, as qf->metadata->range is 128-bit. The following change fixes it and it still passes the ctest --verbose unit test suite.

diff --git a/src/gqf.cpp b/src/gqf.cpp
index 606a5e9..3ef9c81 100644
--- a/src/gqf.cpp
+++ b/src/gqf.cpp
@@ -2808,7 +2808,7 @@ void _qf_multi_merge(QF *qf_arr[],int nqf, QF *qfr,
                                                         ))
 {
        int i;
-       uint64_t range=qf_arr[0]->metadata->range;
+       __uint128_t range=qf_arr[0]->metadata->range;
        for (i=1; i<nqf; i++) {
                if(qf_arr[i]->metadata->range!=range)
                {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions