Skip to content

Fixed ROT13.string thread-safety#1686

Merged
NachoSoto merged 2 commits into
mainfrom
rot-13-thread-safety
Jun 10, 2022
Merged

Fixed ROT13.string thread-safety#1686
NachoSoto merged 2 commits into
mainfrom
rot-13-thread-safety

Conversation

@NachoSoto

@NachoSoto NachoSoto commented Jun 10, 2022

Copy link
Copy Markdown
Contributor

Fixes #1685.

Description

Swift's lazy and static property initialization is always thread-safe. However, key was only created as an empty dictionary, and the evaluation of ROT13.string, which was the one initializing that data, wasn't isolated.
By creating ROT13.key inline, this ensures that the initialization is only done once in a thread-safe way.

Fixes #1685.

### Description

Swift's `lazy` and `static` property initialization is always thread-safe. However, `key` was only created as an empty dictionary, and the evaluation of `ROT13.string`, which was the one initializing that data, wasn't isolated.
By creating `ROT13.key` inline, this ensures that the initialization is only done once in a thread-safe way.
@NachoSoto NachoSoto requested a review from a team June 10, 2022 18:06

@taquitos taquitos left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Taherding is HARD
🐐🎈

@NachoSoto NachoSoto merged commit 7ca2847 into main Jun 10, 2022
@NachoSoto NachoSoto deleted the rot-13-thread-safety branch June 10, 2022 18:31
@NachoSoto NachoSoto mentioned this pull request Jun 10, 2022
NachoSoto added a commit that referenced this pull request Jun 10, 2022
_This release is compatible with Xcode 14 beta 1_

### Bug fixes

* `EntitlementInfo.isActive` returns true if `requestDate == expirationDate` (#1684) via beylmk (@beylmk)
* Fixed usages of `seealso` (#1689) via NachoSoto (@NachoSoto)
* Fixed `ROT13.string` thread-safety (#1686) via NachoSoto (@NachoSoto)
* `PurchasesOrchestrator`: replaced calls to `syncPurchases` with posting receipt for an individual product during SK2 purchases (#1666) via NachoSoto (@NachoSoto)
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.

crash in AttributionFetcher, ROT13 - affecting aobut 5% users in the field.

2 participants