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

util: Zero-initialize result to prevent possible uninit memory read #470

Merged
merged 1 commit into from
Aug 23, 2021

Conversation

MarijnS95
Copy link
Collaborator

Fixes #354

io::Read::read_exact does not receive MaybeUninit memory and a trait implementation can possibly read from our uninitialized vector without unsafe, which is UB. As there is no proper solution to this problem yet (see linked issue), our safest bet is to just take the perf-hit and zero-initialize this vector.

Fixes #354

`io::Read::read_exact` does not receive `MaybeUninit` memory and a trait
implementation can possibly read from our uninitialized vector without
`unsafe`, which is UB.  As there is no proper solution to this problem
yet (see linked issue), our safest bet is to just take the perf-hit and
zero-initialize this vector.
@MaikKlein MaikKlein merged commit 2c98b6f into master Aug 23, 2021
@MarijnS95 MarijnS95 deleted the read-spv-initialize-mem branch August 23, 2021 10:45
MarijnS95 added a commit to MarijnS95/advisory-db that referenced this pull request Aug 23, 2021
MarijnS95 added a commit to MarijnS95/advisory-db that referenced this pull request Aug 23, 2021
Shnatsel pushed a commit to rustsec/advisory-db that referenced this pull request Aug 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reading on uninitialized memory may cause UB ( util::read_spv() )
2 participants