apple / HomeKitADK

Apache License 2.0
2.55k stars 232 forks source link

TLVReader int parsing fixes #126

Open markirb opened 2 years ago

markirb commented 2 years ago

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.

markirb commented 2 years ago

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...