{"id":"RUSTSEC-2021-0044","summary":"Use after free possible in `uri::Formatter` on panic","details":"Affected versions of this crate transmuted a `&str` to a `&'static str` before\npushing it into a `StackVec`, this value was then popped later in the same\nfunction.\n\nThis was assumed to be safe because the reference would be valid while the\nmethod's stack was active. In between the push and the pop, however, a function\n`f` was called that could invoke a user provided function.\n\nIf the user provided panicked, then the assumption used by the function was no\nlonger true and the transmute to `&'static` would create an illegal static\nreference to the string. This could result in a freed string being used during\n(such as in a `Drop` implementation) or after (e.g through `catch_unwind`) the\npanic unwinding.\n\nThis flaw was corrected in commit [e325e2f](https://github.com/SergioBenitez/Rocket/commit/e325e2fce4d9f9f392761e9fb58b418a48cef8bb)\nby using a guard object to ensure that the `&'static str` was dropped inside\nthe function.","aliases":["CVE-2021-29935","GHSA-vcw4-8ph6-7vw8"],"modified":"2023-11-08T04:05:43.819286Z","published":"2021-02-09T12:00:00Z","database_specific":{"license":"CC0-1.0"},"references":[{"type":"PACKAGE","url":"https://crates.io/crates/rocket"},{"type":"ADVISORY","url":"https://rustsec.org/advisories/RUSTSEC-2021-0044.html"},{"type":"REPORT","url":"https://github.com/SergioBenitez/Rocket/issues/1534"}],"affected":[{"package":{"name":"rocket","ecosystem":"crates.io","purl":"pkg:cargo/rocket"},"ranges":[{"type":"SEMVER","events":[{"introduced":"0.0.0-0"},{"fixed":"0.4.7"}]}],"ecosystem_specific":{"affected_functions":null,"affects":{"arch":[],"os":[],"functions":[]}},"database_specific":{"cvss":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L","informational":"unsound","categories":["memory-corruption"],"source":"https://github.com/rustsec/advisory-db/blob/osv/crates/RUSTSEC-2021-0044.json"}}],"schema_version":"1.7.3","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L"}]}