Skip to content

From<String> for BoxedString unsound in smartstring crate (also, unmaintained) #1854

@MolotovCherry

Description

@MolotovCherry

The smartstring crate has an unsound implementation for converting String to BoxedString.

At the moment, I don't know exactly what the conditions for the unsound behavior are, but it is documented in their issue 49, and I have an example there which triggers miri. Additionally, I have verified that PR 34 fixes the UB issue I encountered (however I am unsure whether it is still unsound after, or if other unsoundness exists)

The crate seems to be unmaintained as well. The author has not commented on any of the open PR's or issues since 3/24/2022 (afaict), including this one fixing the UB. After checking their profile, they do have 1 commit to a separate repo on 12/16/23, however their activity is quite sparse.

Checking the reverse dependencies, some big crates are using this, like swc.

I have a reproducible example in the issue linked below.

Crate: https://github.com/bodil/smartstring
Issue: bodil/smartstring#49
PR fixing it: bodil/smartstring#34

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