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

serde_v8: fix pointer size assumptions #15613

Merged
merged 1 commit into from Aug 27, 2022
Merged

serde_v8: fix pointer size assumptions #15613

merged 1 commit into from Aug 27, 2022

Conversation

wg
Copy link
Contributor

@wg wg commented Aug 26, 2022

serde_v8 cannot currently be built for 32 bit targets such as armv7-unknown-linux-musleabihf due to the code assuming pointers are 64 bits:

error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
   --> serde_v8/magic/transl8.rs:108:3
    |
108 |   std::mem::transmute(ptr)
    |   ^^^^^^^^^^^^^^^^^^^
    |
    = note: source type: `u64` (64 bits)
    = note: target type: `&T` (32 bits)

This PR casts the serialized u64 fields to usize before transmuting and removes the hardcoded assumption that size_of::<usize>() == 8.

@CLAassistant
Copy link

CLAassistant commented Aug 26, 2022

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@bartlomieju bartlomieju merged commit 09c256d into denoland:main Aug 27, 2022
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 this pull request may close these issues.

None yet

3 participants