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: always throw DivideByZeroException when BloomFilter is empty #3502

Merged
merged 3 commits into from
Sep 29, 2024

Conversation

nan01ab
Copy link
Contributor

@nan01ab nan01ab commented Sep 28, 2024

Description

new BloomFilter allow to create a bloom filter that length is 0(i.e. m allow set to 0), but if it's length is 0, this BloomFilter will always throw DivideByZeroException when call Add or Check.

Type of change

  • Optimization (the change is only an optimization)
  • Style (the change is only a code style for better maintenance or standard purpose)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Copy link
Member

@shargon shargon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was created wrong, it should throw an exception, maybe during the constructor

@Jim8y Jim8y added waiting for review bug Used to tag confirmed bugs labels Sep 28, 2024
@Jim8y
Copy link
Contributor

Jim8y commented Sep 28, 2024

It was created wrong, it should throw an exception, maybe during the constructor

you think it should be fixed the other way?

@shargon
Copy link
Member

shargon commented Sep 28, 2024

It was created wrong, it should throw an exception, maybe during the constructor

you think it should be fixed the other way?

Throw during creation?

@Jim8y
Copy link
Contributor

Jim8y commented Sep 29, 2024

@nan01ab please update accordingly

@nan01ab
Copy link
Contributor Author

nan01ab commented Sep 29, 2024

@nan01ab please update accordingly

updated

@Jim8y Jim8y requested a review from shargon September 29, 2024 01:01
@shargon shargon merged commit 33d0913 into neo-project:master Sep 29, 2024
6 of 7 checks passed
Copy link
Member

@vncoelho vncoelho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good fix as well

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

Successfully merging this pull request may close these issues.

4 participants