mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2024-12-28 03:50:53 +08:00
fix: byte shift when interpreting 32-bit utf-8 codepoints
This commit is contained in:
parent
5b45aa55ca
commit
592d942b3b
@ -209,7 +209,7 @@ static unsigned int utf8ToCodepoint(const char*& s, const char* e) {
|
||||
if (e - s < 4)
|
||||
return REPLACEMENT_CHARACTER;
|
||||
|
||||
unsigned int calculated = ((firstByte & 0x07) << 24)
|
||||
unsigned int calculated = ((firstByte & 0x07) << 18)
|
||||
| ((static_cast<unsigned int>(s[1]) & 0x3F) << 12)
|
||||
| ((static_cast<unsigned int>(s[2]) & 0x3F) << 6)
|
||||
| (static_cast<unsigned int>(s[3]) & 0x3F);
|
||||
|
Loading…
x
Reference in New Issue
Block a user