# RUSTSEC-2024-0407: Fails to ensure slice elements match the slice's declared type

- Database: RustSec
- Published: 2024-03-05
- Modified: 2025-10-28

## Also published as

- [GHSA-F95P-4CV5-8W8X](https://cve.now/GHSA-F95P-4CV5-8W8X.md) (GitHub)

## Affected versions

- linkme (crates.io): fixed in 0.3.24

## Description

Affected versions allow populating a DistributedSlice of T with elements of an
arbitrary other type that coerces to T. For example, elements of type `&&str`
could end up in a slice of type `[&str]`, since `&&str` coerces to `&str` via a
deref coercion.

The flaw was corrected by implementing typechecking for distributed slice
elements in such a way that coercion no longer occurs. The element's type must
be a subtype of the slice's declared element type.

## References

- https://crates.io/crates/linkme
- https://rustsec.org/advisories/RUSTSEC-2024-0407.html
- https://github.com/dtolnay/linkme/issues/82

Page: https://cve.now/RUSTSEC-2024-0407

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
