Skip to content

safety: The grow_zeroed function must zero from old_layout.size() not mi_usable_size #176

Open

Description

@Techcable

Currently, the nightly-only implementation of Allocator::grow_zeroed incorrectly zeroes the memory in the range mi_usable_size(ptr)..new_layout.size(), when the trait contract requires zeroing in the range old_layout.size()..new_layout.size().

This is more than just a breach of contract; it is potentially unsound, as it leaves memory uninitialized that the trait contract requires to be zeroed.

Activity

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

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