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

Safe guard InlineAsm-related structs #3050

Closed
badumbatish opened this issue Jun 13, 2024 · 0 comments · Fixed by #3074
Closed

Safe guard InlineAsm-related structs #3050

badumbatish opened this issue Jun 13, 2024 · 0 comments · Fixed by #3074

Comments

@badumbatish
Copy link
Contributor

badumbatish commented Jun 13, 2024

The current InlineAsm structs have a lot of constructors where we permit the intialization of nullptr and then we would have to test to see if the pointer is nullptr before performing clone_expr (and not to mention other pointer related operation)

Please preview Arthur's review in this PR.

if expr cannot be null then it would be nice to add more assertions to this struct (but in another PR)

  1. remove the empty constructor, as that will set expr to nullptr and thus create an invalid InOut
  2. in the full constructor on line 4850, rust_assert(expr) to ensure that expr is not null
  3. because expr is not null, remove the if (other.expr) checks in both the copy constructor and operator= overload

Originally posted by @CohenArthur in #2982 (comment)

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.

2 participants