Browse Source

Merge pull request #1947 from chadf/fuzzing-4

Eliminate undefined behavior of bit shifting signed int.
pull/1950/head
orignal 1 year ago committed by GitHub
parent
commit
ca8ec6286a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      libi2pd/Base.cpp

2
libi2pd/Base.cpp

@ -301,7 +301,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