{"id":"GHSA-gfgm-chr3-x6px","aliases":["RUSTSEC-2022-0074"],"url":"https://o3.security/vulnerability/GHSA-gfgm-chr3-x6px","summary":"prettytable-rs: Force cast a &Vec<T> 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<T>` and `&[T]` still might not have the same layout. Treating them equally may lead to undefinted behavior (UB).\n","published":"2022-12-30T17:48:30Z","modified":"2023-11-08T04:19:29.041635Z","cvss":null,"epss":null,"cisaKev":null,"exploitsKnown":0,"affectedPackages":[{"ecosystem":"crates.io","name":"prettytable-rs","fixedVersion":"0.10.0"}],"fix":null,"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"}],"provenance":{"sources":["OSV.dev","FIRST.org (EPSS)"],"lastVerified":"2023-11-08T04:19:29.041635Z"}}