Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Index out of bounds #3

Closed
leontoeides opened this issue Jan 2, 2021 · 3 comments
Closed

Index out of bounds #3

leontoeides opened this issue Jan 2, 2021 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@leontoeides
Copy link

When I initialize the Bloom2 filter like so:

let mut bloom_filter: Bloom2<RandomState, CompressedBitmap, MyStruct> = BloomFilterBuilder::default()
    .size(FilterSize::KeyBytes4)
    .build();

I receive the following error when my program is run:

The application panicked (crashed).
Message:  index out of bounds: the len is 16 but the index is 275465
Location: C:\Users\User Name\.cargo\registry\src\github.jparrowsec.cn-1ecc6299db9ec823\bloom2-0.2.0\src\bitmap\compressed_bitmap.rs:254

However, if I initialize like this:

let mut bloom_filter: Bloom2<RandomState, CompressedBitmap, MyStruct> = Bloom2::default();

It works well. Nice and fast!

If you require more detail, let me know!

@domodwyer
Copy link
Owner

Hey @leontoeides

Thanks for reporting this!

It was an oversight with the BloomFilterBuilder::size() method - it would set the key size used by the filter but not expand the underlying bitmap size. This has been fixed in 1105e7a by resizing the underlying bitmap when using the CompressedBitmap implementation :)

Again, thanks for reporting this, it's really appreciated and I am truly pleased you have found the crate useful! 👍

Dom

@domodwyer domodwyer added the bug Something isn't working label Jan 2, 2021
@domodwyer domodwyer self-assigned this Jan 2, 2021
@domodwyer
Copy link
Owner

I have pushed v0.2.1 containing this fix to crates.io 👍

@leontoeides
Copy link
Author

That was fast! Thank you so much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants