Skip to content

Commit 592d942

Browse files
committed
fix: byte shift when interpreting 32-bit utf-8 codepoints
1 parent 5b45aa5 commit 592d942

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/lib_json/json_writer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ static unsigned int utf8ToCodepoint(const char*& s, const char* e) {
209209
if (e - s < 4)
210210
return REPLACEMENT_CHARACTER;
211211

212-
unsigned int calculated = ((firstByte & 0x07) << 24)
212+
unsigned int calculated = ((firstByte & 0x07) << 18)
213213
| ((static_cast<unsigned int>(s[1]) & 0x3F) << 12)
214214
| ((static_cast<unsigned int>(s[2]) & 0x3F) << 6)
215215
| (static_cast<unsigned int>(s[3]) & 0x3F);

0 commit comments

Comments
 (0)