Skip to content

Support zeroed allocations (e.g reserve_zeroed, with_capacity_zeroed) #270

@64

Description

@64

Looking at instances of unsafe in reqwest, there are two places (1, 2) where uninitialized memory is passed to a Read implementation. This is a bad idea (as per https://github.com/rust-lang/rust/pull/62102/files, https://gankro.github.io/blah/initialize-me-maybe/) and can be fixed by just zeroing the memory beforehand.

Unfortunately bytes doesn't provide a good way of doing this. I imagine the ideal solution would involve something that lowers to alloc_zeroed / calloc internally.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions