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

Fixing issue with union padding serialization #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

DrewDAGator
Copy link

In the CommonAPI::SomeIP::OutputStream class, there is a bug in the writeValue(...) overload for serializing a Variant.

Essentially, in the case where it has to pad the serialized union because it has to have a fixed length, i.e. unionLengthWidth == 0, the call to _writeValue(const uint32_t &_value, const uint8_t &_width) for adding the padding is incorrect because it passes in the number of bits to be serialized (8) for width when it should be passing in the number of bytes to be serialized (1), which is what the function is expecting. This causes the function to not add any padding because 8 is an invalid input for the width parameter. This PR changes the 8 to 1. An alternative would be to use one of the uint8_t overloads of _writeValue(...) instead of the uint32_t overload.

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.

None yet

1 participant