Skip to content

DispatchTimeInterval & Date: avoid 32-bit overflows, fix watchOS crashes#2341

Merged
NachoSoto merged 2 commits intowatchos-testsfrom
nacho/sdk-2974-crash-after-purchase-on-watchos
Mar 16, 2023
Merged

DispatchTimeInterval & Date: avoid 32-bit overflows, fix watchOS crashes#2341
NachoSoto merged 2 commits intowatchos-testsfrom
nacho/sdk-2974-crash-after-purchase-on-watchos

Conversation

@NachoSoto
Copy link
Copy Markdown
Contributor

@NachoSoto NachoSoto commented Mar 16, 2023

Fixes #2338, SDKONCALL-237, [SDK-2974].

Int is actually 32 bits in 32-bit platforms, like watchOS still is (sort of).
This fixes 2 potential Int overflows: Date.millisecondsSince1970 and DispatchTimeInterval arithmetic using nanoseconds.

See also #2340.

@NachoSoto NachoSoto added the pr:fix A bug fix label Mar 16, 2023
@NachoSoto NachoSoto requested a review from a team March 16, 2023 19:26
@NachoSoto NachoSoto force-pushed the nacho/sdk-2974-crash-after-purchase-on-watchos branch from d4c7aee to 834455f Compare March 16, 2023 19:26
@NachoSoto NachoSoto force-pushed the nacho/sdk-2974-crash-after-purchase-on-watchos branch from 834455f to 921d312 Compare March 16, 2023 19:27

import Foundation

extension NSDate {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No need to keep using NSDate anymore.

@NachoSoto NachoSoto changed the title DispatchTimeInterval: avoid 32-bit overflows, fix watchOS crashes DispatchTimeInterval & Date: avoid 32-bit overflows, fix watchOS crashes Mar 16, 2023
@NachoSoto NachoSoto merged this pull request into watchos-tests Mar 16, 2023
@NachoSoto NachoSoto deleted the nacho/sdk-2974-crash-after-purchase-on-watchos branch March 16, 2023 19:40
@NachoSoto NachoSoto restored the nacho/sdk-2974-crash-after-purchase-on-watchos branch March 16, 2023 19:40
@NachoSoto
Copy link
Copy Markdown
Contributor Author

Reopened: #2342

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:fix A bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants