diff --git a/Common/Data/Encoding/Shiftjis.h b/Common/Data/Encoding/Shiftjis.h index 7d73ea381a..bcda427d1c 100644 --- a/Common/Data/Encoding/Shiftjis.h +++ b/Common/Data/Encoding/Shiftjis.h @@ -110,8 +110,9 @@ struct ShiftJIS { } else if (row < 0x5F) { // Reduce by 0x40 to account for the above range. *dest++ = 0xE0 + ((row - 0x40 + 1) >> 1); - } else if (row >= 0x80) { - // TODO + } else { + // Rows 0x5F-0x7F and 0x80+ are not encodable. + return 0; } if (row & 1) { diff --git a/Common/Data/Encoding/Utf8.cpp b/Common/Data/Encoding/Utf8.cpp index 737b049bcd..1bc0c1ddb4 100644 --- a/Common/Data/Encoding/Utf8.cpp +++ b/Common/Data/Encoding/Utf8.cpp @@ -207,7 +207,7 @@ void ConvertUTF8ToWString(wchar_t *dest, size_t destSize, std::string_view sourc destSize -= 1; // account for the \0. int size = (int)MultiByteToWideChar(CP_UTF8, 0, source.data(), len, NULL, 0); MultiByteToWideChar(CP_UTF8, 0, source.data(), len, dest, std::min((int)destSize, size)); - dest[size] = 0; + dest[std::min(size, (int)destSize)] = 0; } std::wstring ConvertUTF8ToWString(const std::string_view source) {