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

crossbeam-epoch's atomic.rs doesn't handle alloc::alloc returning null pointers #689

Closed
erickt opened this issue Apr 28, 2021 · 2 comments · Fixed by #690
Closed

crossbeam-epoch's atomic.rs doesn't handle alloc::alloc returning null pointers #689

erickt opened this issue Apr 28, 2021 · 2 comments · Fixed by #690

Comments

@erickt
Copy link
Contributor

erickt commented Apr 28, 2021

In Fuchsia, we're doing an update of our vendored version of crossbeam. As part of it, we found some uses of alloc::alloc that may be incorrect, like https://github.com/crossbeam-rs/crossbeam/blob/master/crossbeam-epoch/src/atomic.rs#L254. According to the documentation for GlobalAlloc, it's possible for allocation to return a null pointer in two cases:

  • memory is exhausted
  • layout doesn't match the allocator's size or alignment constraints.

This risks undefined behavior if these conditions are met.

@taiki-e
Copy link
Member

taiki-e commented Apr 28, 2021

Thanks! I filed #690 to fix this.

@bors bors bot closed this as completed in 93dce5a Apr 28, 2021
@taiki-e
Copy link
Member

taiki-e commented Apr 29, 2021

The fix is released in crossbeam-epoch 0.9.4.

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

Successfully merging a pull request may close this issue.

2 participants