From 703ae3f7a6941b2b662fc42a8fa73cbc9cf68a11 Mon Sep 17 00:00:00 2001 From: Niels Martin Hansen Date: Mon, 1 Jun 2009 15:44:59 +0000 Subject: [PATCH] Fix #859, or rather work around it. There's no good way to detect problematic regexes like the example, and the regex engine lies in wx, so we'll have to do with what wx offers. Put a limit of at most 1000 replacements per line processed, that "should be enough for everyone", and avoids infinite looping. (Also 3000 GET!) Originally committed to SVN as r3000. --- aegisub/src/dialog_search_replace.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aegisub/src/dialog_search_replace.cpp b/aegisub/src/dialog_search_replace.cpp index 721960eb9..a80efada2 100644 --- a/aegisub/src/dialog_search_replace.cpp +++ b/aegisub/src/dialog_search_replace.cpp @@ -476,7 +476,7 @@ void SearchReplaceEngine::ReplaceAll() { if (isReg) { wxRegEx reg(LookFor,regFlags); if (reg.IsValid()) { - size_t reps = reg.ReplaceAll(Text,ReplaceWith); + size_t reps = reg.Replace(Text,ReplaceWith,1000); if (reps > 0) replaced = true; count += reps; }