RUSTSEC-2022-0074

Source
https://rustsec.org/advisories/RUSTSEC-2022-0074
Import Source
https://github.com/rustsec/advisory-db/blob/osv/crates/RUSTSEC-2022-0074.json
JSON Data
https://api.osv.dev/v1/vulns/RUSTSEC-2022-0074
Aliases
Published
2022-12-02T12:00:00Z
Modified
2023-11-08T04:19:29.041635Z
Summary
Force cast a &Vec<T> to &[T]
Details

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.

Database specific
{
    "license": "CC0-1.0"
}
References

Affected packages

crates.io / prettytable-rs

Package

Name
prettytable-rs
View open source insights on deps.dev
Purl
pkg:cargo/prettytable-rs

Affected ranges

Type
SEMVER
Events
Introduced
0.0.0-0
Fixed
0.10.0

Ecosystem specific

{
    "affected_functions": null,
    "affects": {
        "os": [],
        "functions": [],
        "arch": []
    }
}

Database specific

{
    "cvss": null,
    "informational": "unsound",
    "categories": []
}