Commit 60de3744 authored by ianXian's avatar ianXian Committed by Wouter van Oortmerssen

Convert to unsigned char before applying bit shift operator (#4664)

* Convert to unsigned char before applying bit shift operator

* convert to const unsigned char inline

* convert to unsigned char inline
parent e78825e7
......@@ -321,7 +321,7 @@ inline int FromUTF8(const char **in) {
break;
}
}
if ((**in << len) & 0x80) return -1; // Bit after leading 1's must be 0.
if ((static_cast<const unsigned char>(**in) << len) & 0x80) return -1; // Bit after leading 1's must be 0.
if (!len) return *(*in)++;
// UTF-8 encoded values with a length are between 2 and 4 bytes.
if (len < 2 || len > 4) { return -1; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment