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

[BUG] hashtable does not detect hash collisions #248

Open
djminus opened this issue Sep 26, 2024 · 0 comments
Open

[BUG] hashtable does not detect hash collisions #248

djminus opened this issue Sep 26, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@djminus
Copy link

djminus commented Sep 26, 2024

Describe the bug
Hash collision silently overwrites the entry for the old colliding key in hashtable.c. This can result in undefined behavior and mystifying bugs down the line.

To Reproduce

  1. Write a test in hashtable_tests.c where two inserts cause a hash collision (e.g., inserting two separate keys into into a table with element_count 1).
  2. The test should show that the old entry is silently dropped.

Expected behavior
At minimum, the hashtable should return a signal (e.g., error value or assert) to let the caller know that undefined behavior is happening.

@djminus djminus added the bug Something isn't working label Sep 26, 2024
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