Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Undefined Behaviour: This crate doesn't check for cpu flags #74

Closed
dev-ardi opened this issue Apr 18, 2024 · 4 comments
Closed

Undefined Behaviour: This crate doesn't check for cpu flags #74

dev-ardi opened this issue Apr 18, 2024 · 4 comments

Comments

@dev-ardi
Copy link

Describe the bug

This crate has UB on cpus without avx support

To Reproduce

cargo +nightly miri run on a function that has sonic_rs::from_str

Expected behavior

A panic if the target doesn't support avx
Screenshots
image

@liuq19
Copy link
Collaborator

liuq19 commented Apr 19, 2024

low-level SIMD instructions are not supported for MIRI, and the work is in progress. #61

@Nilstrieb
Copy link

If you implement feature detection correctly, Miri should report that it doesn't support avx and you can take the fallback path.
This crate is unsound when running on CPUs that don't support AVX, which exist

@liuq19
Copy link
Collaborator

liuq19 commented Apr 20, 2024

If you implement feature detection correctly, Miri should report that it doesn't support avx and you can take the fallback path. This crate is unsound when running on CPUs that don't support AVX, which exist

yes, there is a TODO here and I ignored it... I will fixed it...

https://github.com/cloudwego/sonic-rs/blob/main/src/util/arch/mod.rs#L2

@liuq19
Copy link
Collaborator

liuq19 commented Apr 22, 2024

Fixed in v0.3.5

@liuq19 liuq19 closed this as completed Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants