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

TLVReader int parsing fixes #126

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

TLVReader int parsing fixes #126

wants to merge 1 commit into from

Conversation

markirb
Copy link

@markirb markirb commented Jul 6, 2022

This fixes strange behavior (in C++) and resulting errors when parsing to:

uint64_t: 255 << 32 has insufficient space
int32_t: 255 << 24 also

It leads to uint64_t only being parsed to 32 bit in my case, also int32 being only "int31"s...
ASAN pointed out those as errors on the log.

This is defined behavior in C++ standard but it leads to non-wanted results.

This fixes strange behavior (in C++) and resulting errors when parsing to:

uint64_t: 255 << 32 has insufficient space
int32_t: 255 << 24 also

It leads to uint64_t only being parsed to 32 bit in my case, also int32 being only "int31"s...
ASAN pointed out those as errors on the log.
@markirb
Copy link
Author

markirb commented Jul 29, 2022

need more input on this? I played around further with this, the u/int64 is definitely a bug on all compilers, be it C or C++....

The int32_t: 255 << 24 seems to be a warning of asan, but seems to work anyways...

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.

2 participants