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

Unsound problems in may_queue crate #110

Open
safe4u opened this issue Jul 7, 2024 · 0 comments
Open

Unsound problems in may_queue crate #110

safe4u opened this issue Jul 7, 2024 · 0 comments

Comments

@safe4u
Copy link

safe4u commented Jul 7, 2024

Hi, thanks for your contribution to this great coroutine library.

However, we have found lots of unsound problems in the util crate may_queue.
For example, the set and get set and get the data without boundary checking for performance consideration.
These functions are actually unsafe since they ask the caller to guarantee the index is in-bound and the compiler fails to check this.

It is certainly ok to mark the unsafe functions as safe and use them with care in 'may'.
But considering the crate may_queue is available in crates.io and these functions are public, we think it's still necessary to make these functions more sound.

Suggestions

Here are some action choices we suggested:

  1. Mark these functions as 'unsafe' which would lead to large code changes.
  2. (recommended) Add assert! or at least debug_assert! macros to validate that the index is in-bound.
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