Skip to content

Miri reports UB with simd_bitmask (FW) #75

Closed as not planned
Closed as not planned
@Licenser

Description

@Licenser

A forward from simd-lite/simd-json#264,

I managed to replicate the UB error from miri with this test:

cargo +nightly  miri test  --features public_imp utf8_validator

I could trigger it with avx2, sse4.2 and avx

#[cfg(all(feature = "public_imp", target_feature = "avx2"))]
#[test]
fn utf8_validator() {
    use simdutf8::basic::imp::ChunkedUtf8Validator;
    unsafe {
        let mut utf8_validator = simdutf8::basic::imp::x86::avx2::ChunkedUtf8ValidatorImp::new();
        let tmpbuf = [
            49, 46, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
            32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
            32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
        ];
        utf8_validator.update_from_chunks(&tmpbuf);
        assert!(utf8_validator.finalize(None).is_ok());
    }
}

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