Skip to content

Conversation

mikeash
Copy link
Contributor

@mikeash mikeash commented Jan 30, 2023

Key paths can store an offset or a pointer in the same field. On 32-bit, the field is considered to be an offset when it's less than the 4kB zero page, and a pointer otherwise.

The check uses a signed comparison, so pointers in the top half of memory would look like negative offsets. Add a check that the offset is zero or positive to avoid this.

rdar://103886537

… half of memory.

Key paths can store an offset or a pointer in the same field. On 32-bit, the field is considered to be an offset when it's less than the 4kB zero page, and a pointer otherwise.

The check uses a signed comparison, so pointers in the top half of memory would look like negative offsets. Add a check that the offset is zero or positive to avoid this.

rdar://103886537
@mikeash mikeash requested a review from al45tair January 30, 2023 18:10
@mikeash
Copy link
Contributor Author

mikeash commented Jan 30, 2023

/cc @fibrechannelscsi since you last touched this code, although it looks like the bug was there in the previous version of the code as well.

Copy link
Contributor

@fibrechannelscsi fibrechannelscsi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like that was missed. Thanks for addressing that!

@mikeash
Copy link
Contributor Author

mikeash commented Jan 30, 2023

@swift-ci please test

@mikeash
Copy link
Contributor Author

mikeash commented Jan 31, 2023

@swift-ci please test macos platform

@mikeash mikeash merged commit 08e1224 into swiftlang:main Feb 1, 2023
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 this pull request may close these issues.

2 participants