From 7a0bc3abb7765355a69aab21f39e41fd3fbf1cfa Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Wed, 29 Aug 2018 14:37:26 -0700 Subject: [PATCH] Fix data indexes in Unicode::fromUTF8 --- src/lib/base/Unicode.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/lib/base/Unicode.cpp b/src/lib/base/Unicode.cpp index 6a077e79..90a166f3 100644 --- a/src/lib/base/Unicode.cpp +++ b/src/lib/base/Unicode.cpp @@ -628,25 +628,25 @@ Unicode::fromUTF8(const UInt8*& data, UInt32& n) case 4: c = ((static_cast(data[0]) & 0x07) << 18) | ((static_cast(data[1]) & 0x3f) << 12) | - ((static_cast(data[1]) & 0x3f) << 6) | - ((static_cast(data[1]) & 0x3f) ); + ((static_cast(data[2]) & 0x3f) << 6) | + ((static_cast(data[3]) & 0x3f) ); break; case 5: c = ((static_cast(data[0]) & 0x03) << 24) | ((static_cast(data[1]) & 0x3f) << 18) | - ((static_cast(data[1]) & 0x3f) << 12) | - ((static_cast(data[1]) & 0x3f) << 6) | - ((static_cast(data[1]) & 0x3f) ); + ((static_cast(data[2]) & 0x3f) << 12) | + ((static_cast(data[3]) & 0x3f) << 6) | + ((static_cast(data[4]) & 0x3f) ); break; case 6: c = ((static_cast(data[0]) & 0x01) << 30) | ((static_cast(data[1]) & 0x3f) << 24) | - ((static_cast(data[1]) & 0x3f) << 18) | - ((static_cast(data[1]) & 0x3f) << 12) | - ((static_cast(data[1]) & 0x3f) << 6) | - ((static_cast(data[1]) & 0x3f) ); + ((static_cast(data[2]) & 0x3f) << 18) | + ((static_cast(data[3]) & 0x3f) << 12) | + ((static_cast(data[4]) & 0x3f) << 6) | + ((static_cast(data[5]) & 0x3f) ); break; default: