GitHub Advisoryadvisory · crates.io
GHSA-3qm2-rfqw-fmrw move_elements can double-free objects on panic
CRITICAL
Official page ↗
- Aliases
- CVE-2021-28031
- Ecosystem
- crates.io
- Packages
- scratchpad
- Severity
- Critical
- CVSS vector
- CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
- Weaknesses
- CWE-415
- Reviewed
- 2022-06-17
Affected packages
• crates.io scratchpad: < 1.3.1 → fixed in 1.3.1
Description
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.
The flaw was fixed in commit `891561bea` by removing the unsafe block and using a plain iterator.
Related
Alias · CVE (1)
- CVE-2021-28031 An issue was discovered in the scratchpad crate before 1.3.1 for Rust. vulnerability
Weakness · CWE (1)
- CWE-415 Double Free weakness