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

dec: is from_raw_parts unsafe? #66

Open
benesch opened this issue Jan 15, 2022 · 0 comments
Open

dec: is from_raw_parts unsafe? #66

benesch opened this issue Jan 15, 2022 · 0 comments

Comments

@benesch
Copy link
Member

benesch commented Jan 15, 2022

#61 got me thinking: if Decimal::<N>::from_raw_parts is provided with a digits value that exceeds the maximum number of digits that can be stored in lsu for the specified N, does memory unsafety result? We should investigate!

If it does, I think we have two options:

  1. Mark from_raw_parts as unsafe and document the danger.
  2. Add a check (or checks?) like those that were added in dec: add to/from raw parts using BCD-encoded versions of LSU #61 and see what the performance impact is.

cc @sploiselle

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

No branches or pull requests

1 participant