prettytable-rs: Force cast a &Vec<T> to &[T] may lead to undefined behavior
Key facts
- Attack vector
- —
- Privileges required
- —
- User interaction
- —
- Attack complexity
- —
- Impact type
- —
- Confidentiality · integrity · availability
- —
- Fix status
- Fixed
No CVSS vector from any source. Fix status from GitHub.
Summary
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).
Why it matters now
SSVC decision points
Not available: CISA has not published SSVC decision points for this record.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| — | prettytable-rs (crates.io) | before 0.10.0 | 0.10.0 | Patch available | GHSA-gfgm-chr3-x6px |
- prettytable-rs (crates.io) Vendor— Affected before 0.10.0 Fixed in 0.10.0 Patch available GHSA-gfgm-chr3-x6px
Remediation
- Fix · GHSA-gfgm-chr3-x6px prettytable-rs (crates.io) Fixed in 0.10.0 Advisory →
Timeline
- 2026-10-03 Threatist record created from GHSA-gfgm-chr3-x6px
References
Sources
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences