GHSA-gfgm-chr3-x6px
prettytable-rs: Force cast a &Vec<T> to &[T] may lead to undefined behavior
GHSA-gfgm-chr3-x6px is a vulnerability with no CVSS score yet in prettytable-rs, published December 2, 2022. No source lists public exploit code. Fixed in prettytable-rs 0.10.0.
- Severity
- UnratedNo CVSS score yet
- Exploit chance
- UnscoredNo EPSS score yet
- Exploitation
- None knownNot on CISA’s or ENISA’s lists
- Fixed in
0.10.0prettytable-rs +1 more
Description
In function Table::as_ref, a reference of vector is force cast to slice. There are multiple problems here:
- To guarantee the size is correct, we have to first do
Vec::shrink_to_fit. The function requires a mutable reference, so we have to force cast from immutable to mutable, which is undefined behavior (UB). - Even if (1) is sound,
&Vec<T>and&[T]still might not have the same layout. Treating them equally may lead to undefinted behavior (UB).
Affected packages
| Package | Affected | Fixed |
|---|---|---|
prettytable-rscrates.io | before 0.10.0 | 0.10.0 |
prettytable-rscrates.io | 0.0.0-0 up to 0.10.0 | 0.10.0 |
What each source reports
GitHub AdvisoriesNo score
prettytable-rs: Force cast a &Vec<T> to &[T] may lead to undefined behavior
In function Table::as_ref, a reference of vector is force cast to slice. There are multiple problems here:
- To guarantee the size is correct, we have to first do
Vec::shrink_to_fit. The function requires a mutable reference, so we have to force cast from immutable to mutable, which is undefined behavior (UB). - Even if (1) is sound,
&Vec<T>and&[T]still might not have the same layout. Treating them equally may lead to undefinted behavior (UB).
- Record
GHSA-gfgm-chr3-x6px- Updated
- 2026-11-02
OSVNo score
prettytable-rs: Force cast a &Vec<T> to &[T] may lead to undefined behavior
In function Table::as_ref, a reference of vector is force cast to slice. There are multiple problems here:
- To guarantee the size is correct, we have to first do
Vec::shrink_to_fit. The function requires a mutable reference, so we have to force cast from immutable to mutable, which is undefined behavior (UB). - Even if (1) is sound,
&Vec<T>and&[T]still might not have the same layout. Treating them equally may lead to undefinted behavior (UB).
- Record
GHSA-gfgm-chr3-x6px- Updated
- 2026-11-02
OSVRUSTSEC-2022-0074No score
Force cast a &Vec<T> to &[T]
In function Table::as_ref, a reference of vector is force cast to slice. There are multiple problems here:
- To guarantee the size is correct, we have to first do
Vec::shrink_to_fit. The function requires a mutable reference, so we have to force cast from immutable to mutable, which is UB. - Even if (1) is sound,
&Vec<T>and&[T]still might not have the same layout. Treating them equally may lead to UB.
- Record
RUSTSEC-2022-0074- Updated
- 2026-11-02
History
| Recorded | Changed | Sources |
|---|---|---|
| first indexed | GitHub Advisories, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.