Skip to content
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

SR-13837: Swift Decimal type crashes on a specific double value #2926

Merged
merged 1 commit into from
Dec 12, 2020

Conversation

spevans
Copy link
Contributor

@spevans spevans commented Nov 22, 2020

  • If a Double is close but less than UInt64.max, then UInt64(value) can
    crash. Add a check to provide the next closest value.

  • Bounds check the exponent when converting a Double to Decimal.
    This prevents initialising from Double values that cannot be
    stored correctly.

  • Add extra checks when passing _length and _exponent to initializers.

@spevans
Copy link
Contributor Author

spevans commented Nov 22, 2020

@swift-ci test

@spevans
Copy link
Contributor Author

spevans commented Nov 22, 2020

@swift-ci test linux

- If a Double is close but less than UInt64.max, then UInt64(value) can
  crash. Add a check to provide the next closest value.

- Bounds check the exponent when converting a Double to Decimal.
  This prevents initialising from Double values that cannot be
  stored correctly.

- Add extra checks when passing _length and _exponent to initializers.
@spevans
Copy link
Contributor Author

spevans commented Nov 25, 2020

@swift-ci test

@spevans
Copy link
Contributor Author

spevans commented Nov 30, 2020

@swift-ci test linux

@spevans
Copy link
Contributor Author

spevans commented Dec 12, 2020

@swift-ci test and merge

1 similar comment
@spevans
Copy link
Contributor Author

spevans commented Dec 12, 2020

@swift-ci test and merge

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