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
Hello 🦀 ,
we (Rust group @sslab-gatech) found a memory-safety/soundness issue in this crate while scanning Rust code on crates.io for potential vulnerabilities.
Functions mutate & mutate2 temporarily duplicate the ownership of an item using the given p (and q).
In case the given function f panics, the duplicated item will be dropped twice.
Proof of Concept
The given program below exhibits a double free error. fn mutate() is invoked within btree.insert_with().
// Tested with `rustc 1.50.0-nightly (7f9c43cf9 2020-12-23)` on Ubuntu 18.04use containers::collections::b_tree::BTree;// containers = "0.9.10"use default_allocator::Heap;// default_allocator = "0.3"use rel::Core;// rel = "0.2"fnmain(){ifletSome(mut btree) = BTree::<i32,Box<u64>,Core,Heap>::new(Core,20){if btree.insert(2,Box::new(1)).is_ok(){while btree
.insert_with(2, |x| {let ret = match x {Some(str) => str,None => Box::new(0),};None::<Option<u64>>.unwrap();return ret;}).is_err(){}}}}
Program Output
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', examples/containers.rs:15:41
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
free(): double free detected in tcache 2
Aborted (core dumped)
Thank you for checking out this issue 👍
The text was updated successfully, but these errors were encountered:
Thank you for your quick feedback!
We are working to submit a paper to a conference using the tool, and we'll probably release it once our work gets accepted :)
Hello 🦀 ,
we (Rust group @sslab-gatech) found a memory-safety/soundness issue in this crate while scanning Rust code on crates.io for potential vulnerabilities.
Issue Description
containers.rs/src/util/mod.rs
Lines 7 to 15 in 58ca022
Functions
mutate
&mutate2
temporarily duplicate the ownership of an item using the givenp
(andq
).In case the given function
f
panics, the duplicated item will be dropped twice.Proof of Concept
The given program below exhibits a double free error.
fn mutate()
is invoked withinbtree.insert_with()
.Program Output
Thank you for checking out this issue 👍
The text was updated successfully, but these errors were encountered: