Skip to content

[5.3] IRGen: Correctly compute the offset for a non-fixed field after… #31924

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

Conversation

aschwaighofer
Copy link
Contributor

… an empty field

Introduce getByteOffsetDuringLayout() so that we can treat empty fields
just like other fixed sized field while performing layout.

Explanation: We used to incorrectly compute the offset of a non-fixed
field after an empty field inside of a closure capture context. This lead to
crashes at runtime because we read memory that the wrong offset.

Scope: Causes Swift programs that caputre empty fields and non-fixed
fields to crash or misbehave.

Risk: Medium, we now correctly compute the offset in such cases.

Testing: Regression test added.

Reviewer: Slava Pestov

rdar://62349871

… an empty field

Introduce getByteOffsetDuringLayout() so that we can treat empty fields
just like other fixed sized field while performing layout.

Explanation: We used to incorrectly compute the offset of a non-fixed
field after an empty field inside of a closure capture context. This lead to
crashes at runtime because we read memory that the wrong offset.

Scope: Causes Swift programs that caputre empty fields and non-fixed
fields to crash or misbehave.

Risk: Medium, we now correctly compute the offset in such cases.

Testing: Regression test added.

Reviewer: Slava Pestov

rdar://62349871
@aschwaighofer aschwaighofer requested a review from a team as a code owner May 20, 2020 19:15
@aschwaighofer
Copy link
Contributor Author

@swift-ci Please test

@aschwaighofer
Copy link
Contributor Author

Original PR: #31863

@aschwaighofer aschwaighofer merged commit b981b7e into swiftlang:release/5.3 May 20, 2020
@AnthonyLatsis AnthonyLatsis added swift 5.3 🍒 release cherry pick Flag: Release branch cherry picks labels Jan 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks swift 5.3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants