CVE-2020-35864

HIGH7.5EPSS 0.17%

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

Published: 8/25/2021Modified: 11/8/2023
Also known as:GHSA-c9h5-hf8r-m97xRUSTSEC-2020-0009

Description

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 (2)

CVSS scores

SourceVersionSeverityVector
osvCVSS 3.1HIGH7.5CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

References (5)