Skip to content

drain_range breaks invariants, causing UB #31

@timtom-dev

Description

@timtom-dev

The drain_range method makes it possible to remove arbitrary byte ranges from the underlying buffer without checking if the start or end points lie on a character boundary. This makes it possible to construct a SmallString that doesn't contain valid UTF8.

The stdlib simply panics if you attempt to drain an invalid range from a String, so I would expect it to do the same here. I'm happy to submit a PR if the maintainers would like!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions