In the standard library in Rust before 1.2.0, BinaryHeap is not panic-safe. The binary heap is left in an inconsistent state when the comparison of generic elements inside sift_up or sift_down_range panics. This bug leads to a drop of zeroed memory as an arbitrary type, which can result in a memory safety violation.
Source: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2015-20001
Reference (s):
- https://github.com/rust-lang/rust/issues/25842
- https://github.com/rust-lang/rust/pull/25856

