Skip to content

mixclient: Dont append to slice with non-zero length.#3397

Merged
davecgh merged 1 commit intodecred:masterfrom
jholdstock:mixing-append
Jun 28, 2024
Merged

mixclient: Dont append to slice with non-zero length.#3397
davecgh merged 1 commit intodecred:masterfrom
jholdstock:mixing-append

Conversation

@jholdstock
Copy link
Member

Immediately appending to a slice initialized with a non-zero length will lead to a slice which is twice as large as intended, with the initial half of the entries being left at their zero value.

This is fixed by initializing the slice with capacity instead of length.

Immediately appending to a slice initialized with a non-zero length will
lead to a slice which is twice as large as intended, with the initial
half of the entries being left at their zero value.

This is fixed by initializing the slice with **capacity** instead of
length.
Copy link
Member

@jrick jrick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

funny bug, glad you caught this. it looks like this only affects the non-initial-blaming RS messages that other peers will send (which will include several zero hashes) but otherwise doesn't look like it is currently breaking anything.

@davecgh davecgh changed the title mixing: Dont append to slice with non-zero length. mixclient: Dont append to slice with non-zero length. Jun 28, 2024
@davecgh davecgh added this to the 2.1.0 milestone Jun 28, 2024
@davecgh davecgh merged commit 0012996 into decred:master Jun 28, 2024
@davecgh davecgh modified the milestones: 2.1.0, 2.0.4 Aug 28, 2024
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.

4 participants