Files
advisory-db/crates/cdr/RUSTSEC-2021-0012.md
Yechan Bae b724f12a5b Update CVE numbers (#777)
* Update CVE numbers

* Fix RUSTSEC-2020-0093

* Add another alias for async-h1 crate
2021-02-25 20:00:25 -05:00

1015 B

[advisory]
id = "RUSTSEC-2021-0012"
package = "cdr"
aliases = ["CVE-2021-26305"]
date = "2021-01-02"
url = "https://github.com/hrektts/cdr-rs/issues/10"
categories = ["memory-exposure"]

[versions]
patched = [">= 0.2.4"]

Reading uninitialized memory can cause UB (Deserializer::read_vec)

Deserializer::read_vec() created an uninitialized buffer and passes it to a user-provided Read implementation (Deserializer.reader.read_exact()).

Passing an uninitialized buffer to an arbitrary Read implementation is currently defined as undefined behavior in Rust. Official documentation for the Read trait explains the following: "It is your responsibility to make sure that buf is initialized before calling read. Calling read with an uninitialized buf (of the kind one obtains via MaybeUninit) is not safe, and can lead to undefined behavior."

The flaw was corrected in commit ce310f7 by zero-initializing the newly allocated buffer before handing it to Deserializer.reader.read_exact().