diff --git a/scintilla/boostregex/BuildBoost.bat b/scintilla/boostregex/BuildBoost.bat index 5282ae1f..28dbf23d 100644 --- a/scintilla/boostregex/BuildBoost.bat +++ b/scintilla/boostregex/BuildBoost.bat @@ -173,7 +173,7 @@ IF [%BOOSTLIBPATH%] == [] ( GOTO USAGE ) -ECHO # Autogenerated file, run BuildBoost.bat [path_to_boost] to generate > %~dp0%\boostpath.mak +ECHO # Autogenerated file, run BuildBoost.bat [path_to_boost] to generate > %WORKPATH%\boostpath.mak ECHO BOOSTPATH=%BOOSTPATH% >> %WORKPATH%\boostpath.mak ECHO BOOSTLIBPATH=%BOOSTLIBPATH% >> %WORKPATH%\boostpath.mak POPD diff --git a/scintilla/boostregex/UTF8DocumentIterator.h b/scintilla/boostregex/UTF8DocumentIterator.h index 534eb7d6..3f36aad2 100644 --- a/scintilla/boostregex/UTF8DocumentIterator.h +++ b/scintilla/boostregex/UTF8DocumentIterator.h @@ -94,6 +94,11 @@ public: else { m_pos += m_utf8Length; + + if (m_pos > m_end) + { + m_pos = m_end; + } m_characterIndex = 0; readCharacter(); } @@ -110,7 +115,7 @@ public: { --m_pos; // Skip past the UTF-8 extension bytes - while (0x80 == (m_doc->CharAt(m_pos) & 0xC0)) + while (0x80 == (m_doc->CharAt(m_pos) & 0xC0) && m_pos > 0) --m_pos; readCharacter(); @@ -133,7 +138,7 @@ private: bool ended() const { - return m_pos == m_end; + return m_pos >= m_end; } int m_pos;