Every CVESearch/Get API key

GHSA-gfgm-chr3-x6px

prettytable-rs: Force cast a &Vec<T> to &[T] may lead to undefined behavior

No scoreFix available

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.

What does this mean?
Severity
UnratedNo CVSS score yet
Exploit chance
UnscoredNo EPSS score yet
Exploitation
None knownNot on CISA’s or ENISA’s lists

Description

In function Table::as_ref, a reference of vector is force cast to slice. There are multiple problems here:

  1. 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).
  2. 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

Affected packages
PackageAffectedFixed
prettytable-rs
crates.io
before 0.10.0
0.10.0
prettytable-rs
crates.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:

  1. 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).
  2. 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:

  1. 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).
  2. 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:

  1. 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.
  2. 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

History
RecordedChangedSources
first indexedGitHub Advisories, OSV

Dates are when Every CVE recorded each change. Upstream dates may differ.

References

MoveEnter Open