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

Small soundness fixes and code cleanup #163

Merged
merged 4 commits into from
Jun 12, 2022
Merged

Small soundness fixes and code cleanup #163

merged 4 commits into from
Jun 12, 2022

Conversation

madsmtm
Copy link
Owner

@madsmtm madsmtm commented Jun 12, 2022

Fix mutability of pointers when sending a message to &mut T, the pointer was coerced using &mut T -> &T, which gives the wrong provenance.

Fix NSArray::new returning an Owned object - Found while experimenting with verification using associated objects in #127.

The pointer was coerced via. `&mut T -> &T` before converting to `*const T` and to `*mut T`, which in the end gives the wrong provenance.
@madsmtm madsmtm added bug Something isn't working A-objc2 Affects the `objc2`, `objc2-exception-helper` and/or `objc2-encode` crates A-framework Affects the framework crates and the translator for them labels Jun 12, 2022
@madsmtm madsmtm added this to the objc2 v0.3 milestone Jun 12, 2022
@madsmtm madsmtm force-pushed the soundness-fixes branch 2 times, most recently from 177cff2 to 17932a6 Compare June 12, 2022 08:02
Easy to accidentally convert immutable pointers to a mutable ones, as is done in `declare` (now fixed).
Found while experimenting with verification using associated objects in #127.
Hard to see difference between unsafe `&*` and safe Deref, and hard to know whether ptr nullability is handled.
@madsmtm madsmtm merged commit d4586ea into master Jun 12, 2022
@madsmtm madsmtm deleted the soundness-fixes branch June 12, 2022 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-framework Affects the framework crates and the translator for them A-objc2 Affects the `objc2`, `objc2-exception-helper` and/or `objc2-encode` crates bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant