-
Notifications
You must be signed in to change notification settings - Fork 243
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
Deserialization of array can panic #834
Comments
Yeah, this is a serious bug. nice catch. There are crates that do this, like arrayvec,
What this unsafe is solving is the possibility that no sensible default initilization exists for |
We want to avoid allocation when possible, but the |
We should use arrayvec instead of my code above because arrayvec avoids possible memory leaks in my code. Also arrayvec already gets used in ff, not really adding a dependency even.
|
The deserialisation code of a static sized array uses
unwrap
instead of propagating the error:algebra/serialize/src/impls.rs
Lines 481 to 483 in 065cd24
This was possibly done since the
try_from_fn
function is experimental. However, it can cause a panic instead of an error return.I would propose to use a vector with capacity. There is probably a way to make it a faster with
unsafe
, but thats not my speciality:The text was updated successfully, but these errors were encountered: