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

glib: Do not use ptr::offset/offset_from for private/impl offset #1115

Merged
merged 1 commit into from Jun 6, 2023

Conversation

heftig
Copy link
Contributor

@heftig heftig commented Jun 5, 2023

Doing this violates Rust's strict provenance rules. Unfortunately, the API for doing this properly (ptr::expose_addr) isn't ready yet. However, we can work around this on stable Rust by casting through isize for offset calculations.

@heftig
Copy link
Contributor Author

heftig commented Jun 5, 2023

Should fix gstreamer-rs#470.

glib/src/subclass/types.rs Outdated Show resolved Hide resolved
@sdroege sdroege added the needs-backport PR needs backporting to the current stable branch label Jun 6, 2023
@sdroege
Copy link
Member

sdroege commented Jun 6, 2023

Should also make a 0.16 bugfix release with this.

@sdroege
Copy link
Member

sdroege commented Jun 6, 2023

Also causes https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/373 . Quite a horrible bug :)

@sdroege sdroege force-pushed the no-offset branch 2 times, most recently from b6c9508 to 5d0c621 Compare June 6, 2023 09:45
@sdroege sdroege force-pushed the no-offset branch 3 times, most recently from 92662f4 to dfa87bf Compare June 6, 2023 09:55
@heftig
Copy link
Contributor Author

heftig commented Jun 6, 2023

LGTM, thanks!

Doing this violates Rust's [strict provenance rules][1]. Unfortunately,
the API for doing this properly ([`ptr::expose_addr`][2]) isn't ready
yet. However, we can work around this on stable Rust by casting through
`isize` for offset calculations.

[1]: https://doc.rust-lang.org/std/ptr/index.html
[2]: https://doc.rust-lang.org/std/primitive.pointer.html#method.expose_addr

Co-authored-by: Sebastian Dröge <sebastian@centricular.com>
GuillaumeGomez
GuillaumeGomez previously approved these changes Jun 6, 2023
@sdroege sdroege merged commit 009aca9 into gtk-rs:master Jun 6, 2023
45 of 46 checks passed
@sdroege sdroege added backported PR was backported to the current stable branch and removed needs-backport PR needs backporting to the current stable branch labels Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backported PR was backported to the current stable branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants