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

fix multiply with overflow error in i686-msvc-windows environment #3

Merged
merged 1 commit into from
Apr 17, 2024

Conversation

Litch1-v
Copy link
Contributor

This PR addresses an integer overflow issue that occurs in the i686-msvc-windows environment. The problem arises in the block_index function due to the calculation expression ((hash >> 32) as usize * num_blocks) >> 32.

In a 32-bit environment, the usize type is 32 bits in size and can represent values up to 2^32 - 1. However, this calculation expression may result in a value that exceeds the representation range of the usize type, causing an overflow error.

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.29%. Comparing base (d992a57) to head (cf1d0c8).

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##             main       #3   +/-   ##
=======================================
  Coverage   94.29%   94.29%           
=======================================
  Files           5        5           
  Lines        1034     1034           
=======================================
  Hits          975      975           
  Misses         59       59           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tomtomwombat tomtomwombat merged commit 1fcf107 into tomtomwombat:main Apr 17, 2024
1 check passed
@tomtomwombat
Copy link
Owner

Thanks. I'll follow up an make it a wrapping_mul and publish 0.7.1

@tomtomwombat
Copy link
Owner

You can find this fix in 0.7.1: https://crates.io/crates/fastbloom/0.7.1

samuelgja added a commit to samuelgja/fastbloom that referenced this pull request Sep 10, 2024
- Update dependencies in Cargo.toml
- Add serde support to bit_vector.rs and hasher.rs
- Implement serialization traits for BlockedBitVec and BloomFilter structs
- Add ArchivedBlockedBitVec and ArchivedBloomFilter structs for archived serialization

Closes tomtomwombat#3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants