Skip to content

Commit

Permalink
wsd: signed-to-unsigned char conversion
Browse files Browse the repository at this point in the history
../common/Protocol.hpp:314:34: runtime error: implicit conversion from
type 'char' of value -68 (8-bit, signed) to type 'const uint8_t' (aka
'const unsigned char') changed the value to 188 (
8-bit, unsigned)
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior
../common/Protocol.hpp:314:34
../common/Protocol.hpp:318:27: runtime error: implicit conversion from
type 'uint8_t' (aka 'unsigned char') of value 188 (8-bit, unsigned) to
type 'char' changed the value to -68 (8-bit, sig
ned)
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior
../common/Protocol.hpp:318:27

Change-Id: Id5677dcd8ce0940e214b4cd4169498b70f52d1f7
Signed-off-by: Ashod Nakashian <[email protected]>
  • Loading branch information
Ashod committed Jan 27, 2025
1 parent 15f88d0 commit e736758
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions common/Protocol.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,8 @@ namespace COOLProtocol
std::string ret(message, abbrevLen);
for (size_t i = abbrevLen; i < messageLen; ++i)
{
const uint8_t unit = message[i];
const bool continuation = (unit & 0xC0) == 0x80;
const char unit = message[i];
const bool continuation = (static_cast<uint8_t>(unit) & 0xC0) == 0x80;
if (!continuation) // likely
break;
ret.push_back(unit);
Expand Down

0 comments on commit e736758

Please sign in to comment.