{"id":"GHSA-gfgm-chr3-x6px","summary":"prettytable-rs: Force cast a &Vec\u003cT\u003e to &[T] may lead to undefined behavior","details":"In function `Table::as_ref`, a reference of vector is force cast to slice. There are multiple problems here:\n1. 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).\n2. Even if (1) is sound, `&Vec\u003cT\u003e` and `&[T]` still might not have the same layout. Treating them equally may lead to undefinted behavior (UB).\n","aliases":["RUSTSEC-2022-0074"],"modified":"2023-11-08T04:19:29.041635Z","published":"2022-12-30T17:48:30Z","database_specific":{"severity":"MODERATE","github_reviewed":true,"github_reviewed_at":"2022-12-30T17:48:30Z","nvd_published_at":null,"cwe_ids":[]},"references":[{"type":"WEB","url":"https://github.com/phsym/prettytable-rs/issues/145"},{"type":"PACKAGE","url":"https://github.com/phsym/prettytable-rs"},{"type":"WEB","url":"https://rustsec.org/advisories/RUSTSEC-2022-0074.html"}],"affected":[{"package":{"name":"prettytable-rs","ecosystem":"crates.io","purl":"pkg:cargo/prettytable-rs"},"ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"0.10.0"}]}],"database_specific":{"source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2022/12/GHSA-gfgm-chr3-x6px/GHSA-gfgm-chr3-x6px.json"}}],"schema_version":"1.9.0"}