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

Don't serialize bools by copying memory #157

Open
wants to merge 3 commits into
base: for-0.52.0
from

Conversation

Projects
None yet
2 participants
@slipher
Copy link
Contributor

slipher commented Feb 4, 2019

Mostly fixes #148 although there could be a few more bools hiding out in structs.

slipher added some commits Feb 4, 2019

Specialize SerializeTraits for bool
It's unsafe to deserialize bool by copying memory from untrusted code
since there may be only 2 valid values.
struct SerializeTraits<bool> {
static void Write(Writer& stream, bool value)
{
stream.Write<uint8_t>(+value);

This comment has been minimized.

@DolceTriade

DolceTriade Feb 5, 2019

Contributor

what does the + do

This comment has been minimized.

@slipher

slipher Feb 11, 2019

Author Contributor

Convert bool to int

@slipher slipher force-pushed the slipher:ipc branch from eb46569 to 72ab987 Feb 11, 2019

@slipher

This comment has been minimized.

Copy link
Contributor Author

slipher commented Feb 11, 2019

Had to add some extra preprocessor magic since bool was defined as a macro on gcc.

@slipher slipher force-pushed the slipher:ipc branch from 72ab987 to 2f3db10 Feb 11, 2019

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