Skip to content

Miri reports UB with simd_bitmask (FW) #75

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
Licenser opened this issue Jan 20, 2023 · 4 comments
Closed

Miri reports UB with simd_bitmask (FW) #75

Licenser opened this issue Jan 20, 2023 · 4 comments

Comments

@Licenser
Copy link
Contributor

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());
    }
}
@Licenser
Copy link
Contributor Author

@Nilstrieb I forwarded your find

@hkratz
Copy link
Contributor

hkratz commented Jan 26, 2023

@Licenser @Nilstrieb Thanks for reporting. Will have a look!

@hkratz
Copy link
Contributor

hkratz commented Jan 26, 2023

This is not a simdutf8 issue. Instead it will be fixed once stdarch is updated in Rust to include the fix in rust-lang/stdarch#1347.

@hkratz hkratz closed this as completed Jan 26, 2023
@hkratz hkratz reopened this Jan 26, 2023
@hkratz hkratz closed this as not planned Won't fix, can't repro, duplicate, stale Jan 26, 2023
@Licenser
Copy link
Contributor Author

Sorry for the false positive :) I admit I didn't even think about looking into it being a issue with core rust, wonderful catch!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants