Skip to content

mplace_field should use ptr_offset_inbounds #437

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

Closed
RalfJung opened this issue Aug 17, 2018 · 1 comment
Closed

mplace_field should use ptr_offset_inbounds #437

RalfJung opened this issue Aug 17, 2018 · 1 comment

Comments

@RalfJung
Copy link
Member

Currently, mplace_field uses ptr.ptr_offset to compute the new pointer. It should use self.ptr_offset_inbounds, or we should make sure that we cover our bases.

Some test cases (that all should be UB):

Test 1:

  • Uses a field access to go out-of-bounds beyond the end, but just turn the result into a raw ptr.
  • Use wrapping_offset to go back inbounds.
  • Use the ptr.

Test 2:

  • Use wrapping_offset to go out-of-bounds before the allocation
  • Use field access to go back in-bounds
  • Use the ptr
@RalfJung
Copy link
Member Author

Duplicate of #447

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

No branches or pull requests

1 participant