Skip to content

XorBinaryFuse silent failure #49

@vprus

Description

@vprus

There is code in XorBinaryFuse8

https://github.com/FastFilter/fastfilter_java/blob/master/fastfilter/src/main/java/org/fastfilter/xor/XorBinaryFuse8.java#L201

that appears to silently fail, and fill the fingerprint array with 0xFF.

Then, the code in mayContain goes like this:

byte f = fingerprint(hash)
f ^= fingerprints[h0] ^ fingerprints[h1] ^ fingerprints[h2];
return (f & 0xff) == 0;

that essentially becomes

f ^= 0xFF ^ 0xFF ^ 0xFF
return (f & 0xff) == 0;

or

f ^= 0xFF;
return (f & 0xFF) == 0;

or

return (f == 0xFF)

In other words, mayContain will now return false most inputs, generating false negatives.

I would suggest that this behaviour is catastrophic in practical code, and a better approach would be to modify the code to through an exception.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions