Skip to content

UB detected by miri #264

@kdy1

Description

@kdy1

Hi. I'm author of the swc project and swc is using this library.

While trying to run tests with miri, miri detected UB


error: Undefined Behavior: trying to retag from <wildcard> for SharedReadOnly permission at alloc99614[0x0], but no exposed tags have suitable permission in the borrow stack for this location
   --> /Users/kdy1/.cargo/registry/src/github.com-1ecc6299db9ec823/string_cache-0.8.4/src/atom.rs:256:21
    |
256 |                     &(*entry).string
    |                     ^^^^^^^^^^^^^^^^
    |                     |
    |                     trying to retag from <wildcard> for SharedReadOnly permission at alloc99614[0x0], but no exposed tags have suitable permission in the borrow stack for this location
    |                     this error occurs as part of retag at alloc99614[0x0..0x10]
    |
    = help: this indicates a potential bug in the program: it performed an invalid operation, but the Stacked Borrows rules it violated are still experimental
    = help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md for further information
    = note: BACKTRACE:
    = note: inside `<string_cache::atom::Atom<swc_atoms::JsWordStaticSet> as std::ops::Deref>::deref` at /Users/kdy1/.cargo/registry/src/github.com-1ecc6299db9ec823/string_cache-0.8.4/src/atom.rs:256:21
note: inside `tests::access_tag` at crates/jsdoc/src/lib.rs:710:21

My rust-toolchain is

nightly-2022-09-14

and I ran cargo miri test from the root of swc repository.

I'm not sure, but I guess this can be related to segfault mentioned in #33

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions