axelarnetwork / tofn

A threshold cryptography library in Rust
Apache License 2.0
112 stars 23 forks source link

FillVec overwrite always increases some_count #50

Closed ggutoski closed 3 years ago

ggutoski commented 3 years ago

https://github.com/axelarnetwork/tofn/blob/bf81a677cae92520f97a4a28f1188a7d927f428d/src/fillvec.rs#L30-L34 This method increments some_count regardless of whether stored was Some or None. If stored was Some then some_count should not be incremented.

The fix is to increment some_count only when stored was None.

It's a miracle we went so long without noticing this problem.