move_elements can double-free objects on panic
Critical severity
GitHub Reviewed
Published
May 24, 2022
to the GitHub Advisory Database
•
Updated Jun 13, 2023
Description
Published by the National Vulnerability Database
Mar 5, 2021
Published to the GitHub Advisory Database
May 24, 2022
Reviewed
Jun 17, 2022
Last updated
Jun 13, 2023
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.References