Fixed infinite loop with RegExpSubstitute when Substitute has a empty string.

http://rainmeter.net/forum/viewtopic.php?f=14&t=13377
http://rainmeter.net/forum/viewtopic.php?f=14&t=10954
This commit is contained in:
Brian Ferguson 2012-09-04 09:33:25 -06:00
parent 0f97ddf497
commit 42061a7b66

View File

@ -246,6 +246,11 @@ const WCHAR* CMeasure::CheckSubstitute(const WCHAR* buffer)
int flags = PCRE_UTF8; int flags = PCRE_UTF8;
int offset = 0; int offset = 0;
if (m_Substitute[i] == L"")
{
m_Substitute[i] = L"^$";
}
re = pcre_compile( re = pcre_compile(
ConvertToUTF8(m_Substitute[i].c_str()).c_str(), // the pattern ConvertToUTF8(m_Substitute[i].c_str()).c_str(), // the pattern
flags, // default options flags, // default options