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

misaligned pointer dereference #11

Closed
stephanemagnenat opened this issue Jul 24, 2023 · 5 comments · Fixed by #12
Closed

misaligned pointer dereference #11

stephanemagnenat opened this issue Jul 24, 2023 · 5 comments · Fixed by #12

Comments

@stephanemagnenat
Copy link

stephanemagnenat commented Jul 24, 2023

Using Rust 1.71 on a Wasm target, I am getting the following error in debug mode:

book_web_advanced.js:470 panicked at 'misaligned pointer dereference: address must be a multiple of 0x10 but is 0x3cabc8',
.cargo/registry/src/index.crates.io-6f17d22bba15001f/simd-adler32-0.3.5/src/imp/wasm.rs:103

I am using simd-adler32 indirectly through several dependencies of the image crate (for example png), and I am compiling the wasm with the following flag: RUSTFLAGS="-C target-feature=+simd128" .

My understanding is that we are hitting the recently-merged (1.70) safety check: rust-lang/rust#98112

@CryZe
Copy link
Contributor

CryZe commented Jul 24, 2023

Seems like this is a bug that I introduced. Interestingly in my other PR for NEON SIMD, I was aware of the unaligned load, weird that I missed it on WASM. I'll do a PR.

@mcountryman
Copy link
Owner

@stephanemagnenat this fix is in simd-adler32@0.3.6. You'll have to temporarily target that version. I believe the cargo.patch config might get what you need until the entire dependency chain gets updated.

@CryZe
Copy link
Contributor

CryZe commented Jul 24, 2023

You just need cargo update in the normal case.

@mcountryman
Copy link
Owner

Right, it's a minor version change.

@stephanemagnenat
Copy link
Author

Thank you very much for the fast reaction!

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

Successfully merging a pull request may close this issue.

3 participants