{"id":"GHSA-3qm2-rfqw-fmrw","summary":"move_elements can double-free objects on panic","details":"Affected versions of scratchpad used ptr::read to read elements while calling a user provided function f on them. Since the pointer read duplicates ownership, a panic inside the user provided f function could cause a double free when unwinding.\n\nThe flaw was fixed in commit `891561bea` by removing the unsafe block and using a plain iterator.","aliases":["CVE-2021-28031","RUSTSEC-2021-0030"],"modified":"2023-11-01T04:54:58.072927Z","published":"2022-05-24T17:43:48Z","database_specific":{"cwe_ids":["CWE-415"],"severity":"CRITICAL","github_reviewed":true,"github_reviewed_at":"2022-06-17T00:23:59Z","nvd_published_at":"2021-03-05T09:15:00Z"},"references":[{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2021-28031"},{"type":"WEB","url":"https://github.com/okready/scratchpad/issues/1"},{"type":"WEB","url":"https://github.com/okready/scratchpad/commit/891561bea"},{"type":"PACKAGE","url":"https://github.com/okready/scratchpad"},{"type":"WEB","url":"https://rustsec.org/advisories/RUSTSEC-2021-0030.html"}],"affected":[{"package":{"name":"scratchpad","ecosystem":"crates.io","purl":"pkg:cargo/scratchpad"},"ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"1.3.1"}]}],"database_specific":{"source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2022/05/GHSA-3qm2-rfqw-fmrw/GHSA-3qm2-rfqw-fmrw.json"}}],"schema_version":"1.9.0","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"}]}