RUSTSEC-2020-0009

    Dashboard / Vulnerabilities / RUSTSEC-2020-0009

    RUSTSEC-2020-0009

    Published: 11 Apr 2020Last Modified: 8 Nov 2023

    Summary: `read_scalar` and `read_scalar_at` allow transmuting values without `unsafe` blocks

    Details: The `read_scalar` and `read_scalar_at` functions are unsound because they allow transmuting values without `unsafe` blocks. The following example shows how to create a dangling reference: ``` fn main() { #[derive(Copy, Clone, PartialEq, Debug)] struct S(&'static str); impl flatbuffers::EndianScalar for S { fn to_little_endian(self) -> Self { self } fn from_little_endian(self) -> Self { self } } println!("{:?}", flatbuffers::read_scalar::<S>(&[1; std::mem::size_of::<S>()])); } ```

    Affected packages

    Package

    Name: flatbuffers

    Purl: pkg:cargo/flatbuffers

    Affected ranges

    Type: SEMVER

    Events:

    Introduced- 0.4.0
    Fixed -2.0.0

    Affected versions

    Common Vulnerability Scoring System

    Attack Vector
    Network
    Adjacent
    Local
    Physical
    Privileges Required
    None
    Low
    High
    User Interaction
    None
    Required
    Scope
    Unchanged
    Changed
    Confidentiality
    None
    Low
    High
    Integrity
    None
    Low
    High
    Availability
    None
    Low
    High
    RUSTSEC-2020-0009 | CVE-DB