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

Fix possible integer overflow when serializing log_val_type. #404

Merged
merged 1 commit into from
Mar 21, 2023

Conversation

cbucher
Copy link
Contributor

@cbucher cbucher commented Mar 3, 2023

We can see that the "custom" entrie of the log_val_type enum is set to 999. However, when this value is serialized, it is cast as 8bit unsigned integer which maximum value is 255.

We type the enumeration to 8bit interger and we change the value of custom to 999 (given that 999 % 256 = 231).

#400

We can see that the "custom" entrie of the log_val_type enum is set to 999. However, when this value is serialized, it
is cast as 8bit unsigned integer which maximum value is 255.

We type the enumeration to 8bit interger and we change the value of custom to 999 (given that 999 % 256 = 231).
@cbucher cbucher mentioned this pull request Mar 8, 2023
Copy link
Contributor

@greensky00 greensky00 left a comment

Choose a reason for hiding this comment

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

Thanks!

@greensky00 greensky00 merged commit d5e66a0 into eBay:master Mar 21, 2023
@antonio2368
Copy link
Contributor

antonio2368 commented Jun 9, 2023

This actually breaks backward compatibility because of serialization of the enum type (previously it wasn't written as byte because of 999).
😢

It can be fixed easily but it wasn't clear what happened.

@greensky00
Copy link
Contributor

@antonio2368 sorry for the trouble. There are a few more enums without explicit type, and they are actually treated as byte (== uint8_t). These should be also fixed. Are you using any of them?

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.

3 participants