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

Correct boundary for key_size in lsh_table.h #106

Closed
ghost opened this issue May 23, 2013 · 1 comment
Closed

Correct boundary for key_size in lsh_table.h #106

ghost opened this issue May 23, 2013 · 1 comment

Comments

@ghost
Copy link

ghost commented May 23, 2013

Hello,
please check the cast to size_t(1 << key_size_) in the resizing of the dynamic bitset in lsh_table.h + dynamic_bitset.h. I guess, the result of the expression 1 << 31 is interpreted as a signed integer result (32bit). Then the result ist casted to 64bit and then reinterpreted as unsigned 64 bit integer, which is done by addding UINTMAX+1. But UINTMAX is now defined for 64 bit integers resulting in very large numbers.

The result is 18446744071562067968 instead of the expected 2147483648 (256 MB), which causes a bad alloc in the dynamic bitset resize function. A cast to unsigned int instead of size_t would fix this problem for me...

Nevertheless: Great library :)

mariusmuja added a commit that referenced this issue May 27, 2013
@mariusmuja
Copy link
Collaborator

Should be fixed by commit b72d526, please re-open the issue if not.

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

No branches or pull requests

1 participant