From 42061a7b66a9934e44edf7b74923464ff9d6f62a Mon Sep 17 00:00:00 2001 From: Brian Ferguson Date: Tue, 4 Sep 2012 09:33:25 -0600 Subject: [PATCH] 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 --- Library/Measure.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Library/Measure.cpp b/Library/Measure.cpp index aefe670c..d7a6980a 100644 --- a/Library/Measure.cpp +++ b/Library/Measure.cpp @@ -246,6 +246,11 @@ const WCHAR* CMeasure::CheckSubstitute(const WCHAR* buffer) int flags = PCRE_UTF8; int offset = 0; + if (m_Substitute[i] == L"") + { + m_Substitute[i] = L"^$"; + } + re = pcre_compile( ConvertToUTF8(m_Substitute[i].c_str()).c_str(), // the pattern flags, // default options