diff --git a/PowerEditor/src/Utf8_16.cpp b/PowerEditor/src/Utf8_16.cpp index d306f44f7..acf8c3878 100644 --- a/PowerEditor/src/Utf8_16.cpp +++ b/PowerEditor/src/Utf8_16.cpp @@ -152,7 +152,7 @@ size_t Utf8_16_Read::convert(char* buf, size_t len) case uni16LE_NoBOM: case uni16BE: case uni16LE: { - size_t newSize = len + len / 2 + 1; + size_t newSize = (len + len % 2) + (len + len % 2) / 2; if (m_nAllocatedBufSize != newSize) { diff --git a/PowerEditor/src/Utf8_16.h b/PowerEditor/src/Utf8_16.h index a539a8a4b..817cdc024 100644 --- a/PowerEditor/src/Utf8_16.h +++ b/PowerEditor/src/Utf8_16.h @@ -53,7 +53,7 @@ public: bool get(utf8 *c); void operator++(); eState getState() { return m_eState; }; - operator bool() { return (m_pRead < m_pEnd) || (m_out1st != m_outLst); }; + operator bool() { return (m_pRead + 1 < m_pEnd) || (m_out1st != m_outLst); }; protected: void read();