Skip to content

Add advisory for UB in crossbeam-channel 0.4.3 - #425

Merged
Shnatsel merged 3 commits into
rustsec:masterfrom
taiki-e:crossbeam-533
Oct 11, 2020
Merged

Shnatsel merged 3 commits into
rustsec:masterfrom
taiki-e:crossbeam-533

Conversation

@taiki-e

@taiki-e taiki-e commented Oct 11, 2020

Copy link
Copy Markdown
Contributor

The affected version of this crate's the bounded channel incorrectly assumes that Vec::from_iter has allocated capacity that same as the number of iterator elements. Vec::from_iter does not actually guarantee that and may allocate extra memory. The destructor of the bounded channel reconstructs Vec from the raw pointer based on the incorrect assumes described above. This is unsound and causing deallocation with the incorrect capacity when Vec::from_iter has allocated different sizes with the number of iterator elements.

Refs: crossbeam-rs/crossbeam#533, crossbeam-rs/crossbeam#539 (Both issues are mainly saying about crossbeam-queue, but crossbeam-queue including this UB, has not been released and only crossbeam-channel is affected.)

@Shnatsel

Shnatsel commented Oct 11, 2020

Copy link
Copy Markdown
Member

Thanks for the report!

Is this purely theoretical at this point, or has deallocation of the incorrect size has actually been observed in practice? If it's the latter, I'd drop informational = "unsound".

Last time I checked from_iter never over-allocated in practice, but that was over a year ago and there have been some optimizations for small vector sizes, like the first allocation was always having size 4.

@taiki-e

taiki-e commented Oct 11, 2020

Copy link
Copy Markdown
Contributor Author

Is this purely theoretical at this point, or has deallocation of the incorrect size has actually been observed in practice? If it's the latter, I'd drop informational = "unsound".

It has actually been observed in practice (https://twitter.com/khuey_/status/1311641831201857537, nervosnetwork/ckb#2244), so I'll drop informational field.

Last time I checked from_iter never over-allocated in practice, but that was over a year ago and there have been some optimizations for small vector sizes, like the first allocation was always having size 4.

If the number of elements is small, it seems that 0-7 extra capacity is allocated depending on the size of the elements.
(playground)

@Shnatsel

Copy link
Copy Markdown
Member

Merging. Thanks!

@Shnatsel
Shnatsel merged commit 75a51cb into rustsec:master Oct 11, 2020
@taiki-e
taiki-e deleted the crossbeam-533 branch October 11, 2020 13:00
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 12, 2020
CjS77 added a commit to tari-project/broadcast_channel that referenced this pull request Jun 7, 2022
Impact
The affected version of this crate's the bounded channel incorrectly assumes that Vec::from_iter has allocated capacity that same as the number of iterator elements. Vec::from_iter does not actually guarantee that and may allocate extra memory. The destructor of the bounded channel reconstructs Vec from the raw pointer based on the incorrect assumes described above. This is unsound and causing deallocation with the incorrect capacity when Vec::from_iter has allocated different sizes with the number of iterator elements.

Patches
This has been fixed in crossbeam-channel 0.4.4.

We recommend users to upgrade to 0.4.4.

References
See crossbeam-rs/crossbeam#533, crossbeam-rs/crossbeam#539, and rustsec/advisory-db#425 for more details.
CjS77 added a commit to tari-project/broadcast_channel that referenced this pull request Jun 7, 2022
Impact
The affected version of this crate's the bounded channel incorrectly assumes that Vec::from_iter has allocated capacity that same as the number of iterator elements. Vec::from_iter does not actually guarantee that and may allocate extra memory. The destructor of the bounded channel reconstructs Vec from the raw pointer based on the incorrect assumes described above. This is unsound and causing deallocation with the incorrect capacity when Vec::from_iter has allocated different sizes with the number of iterator elements.

Patches
This has been fixed in crossbeam-channel 0.4.4.

We recommend users to upgrade to 0.4.4.

References
See crossbeam-rs/crossbeam#533, crossbeam-rs/crossbeam#539, and rustsec/advisory-db#425 for more details.
CjS77 added a commit to tari-project/broadcast_channel that referenced this pull request Jun 7, 2022
Impact
The affected version of this crate's the bounded channel incorrectly assumes that Vec::from_iter has allocated capacity that same as the number of iterator elements. Vec::from_iter does not actually guarantee that and may allocate extra memory. The destructor of the bounded channel reconstructs Vec from the raw pointer based on the incorrect assumes described above. This is unsound and causing deallocation with the incorrect capacity when Vec::from_iter has allocated different sizes with the number of iterator elements.

Patches
This has been fixed in crossbeam-channel 0.4.4.

We recommend users to upgrade to 0.4.4.

References
See crossbeam-rs/crossbeam#533, crossbeam-rs/crossbeam#539, and rustsec/advisory-db#425 for more details.
CjS77 added a commit to tari-project/broadcast_channel that referenced this pull request Jun 7, 2022
Impact
The affected version of this crate's the bounded channel incorrectly assumes that Vec::from_iter has allocated capacity that same as the number of iterator elements. Vec::from_iter does not actually guarantee that and may allocate extra memory. The destructor of the bounded channel reconstructs Vec from the raw pointer based on the incorrect assumes described above. This is unsound and causing deallocation with the incorrect capacity when Vec::from_iter has allocated different sizes with the number of iterator elements.

Patches
This has been fixed in crossbeam-channel 0.4.4.

We recommend users to upgrade to 0.4.4.

References
See crossbeam-rs/crossbeam#533, crossbeam-rs/crossbeam#539, and rustsec/advisory-db#425 for more details.
north-echo added a commit to north-echo/advisory-db that referenced this pull request Aug 13, 2026
Eleven decode paths in the TDS client respond to server-controlled
values with panic!, unimplemented!, todo! or unwrap() on None rather
than returning Err. Three are in PRELOGIN, so they are reachable
pre-auth and pre-TLS.

Reported publicly as tiberius-rs/tiberius#424 and rustsec#425 on 2026-07-29 with
no maintainer response since.
north-echo added a commit to north-echo/advisory-db that referenced this pull request Aug 13, 2026
Eleven decode paths in the TDS client respond to server-controlled
values with panic!, unimplemented!, todo! or unwrap() on None rather
than returning Err. Three are in PRELOGIN, so they are reachable
pre-auth and pre-TLS.

Reported publicly as tiberius-rs/tiberius#424 and rustsec#425 on 2026-07-29 with
no maintainer response since.

Assisted-by: Claude <noreply@anthropic.com>
north-echo added a commit to north-echo/advisory-db that referenced this pull request Sep 18, 2026
The repo moved to the tiberius-rs org and gained a new maintainer team.
PRs rustsec#440 and rustsec#441 merged and close seven of the eleven sites. Issues
rustsec#424 and rustsec#425 were closed as fixed by rustsec#440, but four sites are still
present on the development branch, verified against feb8df2 in a
release build: token_row.rs decode and decode_nbc, type_info.rs for
SSVariant and Udt, and the bare assert! in token_env_change.rs.

Patches for those four are in the unmerged rustsec#443, sequenced behind a
breaking change in rustsec#442.

No release has been cut, so patched stays empty and every published
version is affected by all eleven. Drops the stale claim that no
maintainer had responded, and retargets the links from prisma/tiberius
to tiberius-rs/tiberius.

Assisted-by: Claude <noreply@anthropic.com>
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.

2 participants