You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are @purseclab, and we are fuzzing Rust crates to identify memory violation bugs. Although we are aware that this crate is unmaintained, we noticed on crates.io that it is still being downloaded. Therefore, we decided to report a memory violation bug we discovered.
The PoC below causes a double-free memory violation.
More specifically, in line 1393 the pointer p is initialized to point to the location where the provided element should be inserted. However, the way that p is used in the subsequent call to ptr::copy does not correctly shift the elements with indices less than index towards the front of the deque.
Also, is possible for the element at the location index + 1 to get duplicated. If the duplicated element implements the Drop trait, the destructor of SliceDeque will attempt to free the element twice, resulting in a double free memory violation.
Hello,
We are @purseclab, and we are fuzzing Rust crates to identify memory violation bugs. Although we are aware that this crate is unmaintained, we noticed on crates.io that it is still being downloaded. Therefore, we decided to report a memory violation bug we discovered.
The PoC below causes a double-free memory violation.
PoC:
Bug Description:
We believe this bug is caused by
slice_deque::SliceDeque::insert
:slice_deque/src/lib.rs
Lines 1390 to 1398 in 045fb28
More specifically, in line 1393 the pointer p is initialized to point to the location where the provided element should be inserted. However, the way that
p
is used in the subsequent call toptr::copy
does not correctly shift the elements with indices less thanindex
towards the front of the deque.Also, is possible for the element at the location
index + 1
to get duplicated. If the duplicated element implements theDrop
trait, the destructor ofSliceDeque
will attempt to free the element twice, resulting in a double free memory violation.How to Build and Run the PoC:
RUSTFLAGS="-Zsanitizer=address" cargo run
Output:
Proposed Fix:
Change the lines 1393-1395 as follows,
Output:
Details:
The text was updated successfully, but these errors were encountered: