Skip to content

Bounded queue does not work correctly with sizes not power of 2 #11

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

Closed
link2xt opened this issue May 13, 2021 · 2 comments
Closed

Bounded queue does not work correctly with sizes not power of 2 #11

link2xt opened this issue May 13, 2021 · 2 comments

Comments

@link2xt
Copy link

link2xt commented May 13, 2021

Here is a report of a queue of size 1000 crashing trying to access index 1020 during dequeueing: https://github.com/deltachat/deltachat-core-rust/issues/2442

Edit: I posted a "testcase" here previously, but actually it does not reproduce the problem

@link2xt
Copy link
Author

link2xt commented May 15, 2021

After checking all the code paths, I don't see the way index inside of head can become 1020 for a queue of size 1000. :/

@link2xt
Copy link
Author

link2xt commented May 15, 2021

Maybe it is a hardware problem, feel free to close this if you are sure that index inside of head can't exceed bounded queue size.

I have made a small fix as a result of reading the code, but it is unlikely to affect 64-bit systems, especially fix a cause of crashes in apps early after startup: #12

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

No branches or pull requests

1 participant