Skip to content

AioCb::from_boxed_slice violates mutability guarantees #788

Closed
@asomers

Description

@asomers

An Rc<Box<[u8]>> does not have interior mutability. It's supposed to be impossible to update its contents. But AioCb::from_boxed_slice current allows you to. It does it by casting a *const c_void to a *mut c_void. Technically, that's a safe operation. The only unsafe part is when you dereference the pointer. But we have to do that in an unsafe block anyway, so the compiler never alerted us to the mutability problem.

Fixing this issue is trivial. The problem is that nix's consumers may be relying on this behavior.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions