Skip to content

Fix UB in getsockopt#1214

Merged
bors[bot] merged 1 commit intonix-rust:masterfrom
asomers:issue_1212
Apr 13, 2020
Merged

Fix UB in getsockopt#1214
bors[bot] merged 1 commit intonix-rust:masterfrom
asomers:issue_1212

Conversation

@asomers
Copy link
Copy Markdown
Member

@asomers asomers commented Apr 12, 2020

The old code tried to zero-initialize an enum for which 0 is not a valid
value. That worked for older compilers, but triggers a panic with Rust
1.44.0. The correct technique is to use mem::MaybeUninit.

Fixes #1212

The old code tried to zero-initialize an enum for which 0 is not a valid
value.  That worked for older compilers, but triggers a panic with Rust
1.44.0.  The correct technique is to use mem::MaybeUninit.

Fixes nix-rust#1212
@asomers
Copy link
Copy Markdown
Member Author

asomers commented Apr 12, 2020

@srikwit could you please review?

@srikwit
Copy link
Copy Markdown

srikwit commented Apr 13, 2020

Yes I am reviewing it.

@srikwit
Copy link
Copy Markdown

srikwit commented Apr 13, 2020

All tests have passed! LGTM.

Copy link
Copy Markdown
Member Author

@asomers asomers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bors r+

@bors
Copy link
Copy Markdown
Contributor

bors bot commented Apr 13, 2020

Build succeeded

@bors bors bot merged commit 154ff58 into nix-rust:master Apr 13, 2020
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.

Can't zero-initialize SockType

2 participants