From 7e1063f22ed0f8ff9a13284eed1d8279a2f2ad98 Mon Sep 17 00:00:00 2001 From: Abs62 Date: Sat, 4 Feb 2023 18:53:35 +0300 Subject: [PATCH] DSL: Fix freezes on some incorrect dictionaries --- dsl_details.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dsl_details.cc b/dsl_details.cc index ac0b1d91..f605f5e4 100644 --- a/dsl_details.cc +++ b/dsl_details.cc @@ -1286,6 +1286,13 @@ void processUnsortedParts( wstring & str, bool strip ) void expandOptionalParts( wstring & str, list< wstring > * result, size_t x, bool inside_recurse ) { + if( str.size() > 500 ) + { + // Don't expand too long headwords - it is highly likely incorrect dictionary + result->push_back( str ); + return; + } + list< wstring > expanded; list< wstring > * headwords; headwords = inside_recurse ? result : &expanded;