Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Security Vulnerabilities: flatbuffers: read_scalar and read_scalar_at allow transmuting values without unsafe blocks #476

Closed
BohuTANG opened this issue Jun 21, 2021 · 0 comments · Fixed by #499
Labels

Comments

@BohuTANG
Copy link

Describe the bug

https://deps.rs/repo/github/apache/arrow-rs#vulnerabilities

flatbuffers: read_scalar and read_scalar_at allow transmuting values without unsafe blocks
RUSTSEC-2020-0009

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>()]));
}

To Reproduce

https://deps.rs/repo/github/apache/arrow-rs#vulnerabilities

Expected behavior
A clear and concise description of what you expected to happen.

Additional context
See advisory page for additional details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant