Skip to content

Conversation

cpubot
Copy link

@cpubot cpubot commented Oct 15, 2025

Problem

It's possible to get BitVec into an invalid state when deserializing under the following conditions:

  • Encoded sequence has length zero (for any type T), because all sequence lengths are encoded as u64
  • Encoded sequence of bytes where length is < NUM_WORDS

This can trigger a panic, because boundary checks use constants like NUM_WORDS and NUM_BITS, which are meaningless if the inner vec's state is out of sync with them

Summary of Changes

Deserialize impl of BitVec now ensures it has the expected number of words

@cpubot cpubot requested a review from alessandrod October 15, 2025 04:19
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.

1 participant