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

IPC: Unsound handling of bools #148

Open
slipher opened this Issue Dec 29, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@slipher
Copy link
Contributor

slipher commented Dec 29, 2018

The IPC serialization code assumes that any POD type can be communicated by simply copying the memory. This is a problem if not every possible sequence of bytes represents a valid value.

In particular, the assumption opens the possibility of sending spooky bools which behave as true in some contexts and false in others, or have values other than 0 or 1 after an integer promotion.

Of course it's easy to make a specialization for bool itself, but bools in structs pose much more of a problem. There are various large structs which are serialized by copying, some of which contain bools. Maybe we would need some static analysis to prevent any bools from being added to them.

@DolceTriade

This comment has been minimized.

Copy link
Contributor

DolceTriade commented Jan 1, 2019

ya, we've had this issue with vector bools as well...though we just made a specialization for it.

@slipher

This comment has been minimized.

Copy link
Contributor

slipher commented Jan 1, 2019

vector<bool> is a different issue: when you index into it you get a proxy object instead of bool& and the serialization code wouldn't/shouldn't know how to copy the proxy object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment