Browse Source

Eliminate undefined behavior of bit shifting signed int.

pull/1947/head
Chad Fraleigh 1 year ago
parent
commit
47dc5591b9
No known key found for this signature in database
GPG Key ID: 2415C39758458A8F
  1. 2
      libi2pd/Base.cpp

2
libi2pd/Base.cpp

@ -298,7 +298,7 @@ namespace data
size_t ByteStreamToBase32 (const uint8_t * inBuf, size_t len, char * outBuf, size_t outLen) size_t ByteStreamToBase32 (const uint8_t * inBuf, size_t len, char * outBuf, size_t outLen)
{ {
size_t ret = 0, pos = 1; size_t ret = 0, pos = 1;
int bits = 8, tmp = inBuf[0]; unsigned int bits = 8, tmp = inBuf[0];
while (ret < outLen && (bits > 0 || pos < len)) while (ret < outLen && (bits > 0 || pos < len))
{ {
if (bits < 5) if (bits < 5)

Loading…
Cancel
Save