fix: dsl dictionary crash when skip expandOptionalParts as headword is too long

This commit is contained in:
Xiao YiFang 2022-05-21 22:50:04 +08:00
parent 2b9b278e83
commit 40f67d7f0f
2 changed files with 3 additions and 10 deletions

7
dsl.cc
View file

@ -2153,10 +2153,9 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
hasString = false; hasString = false;
// The line read should either consist of pure whitespace, or be a // The line read should either consist of pure whitespace, or be a headword
// headword // skip too long headword,it can never be headword.
if( curString.empty() || curString.size() > 100 )
if ( curString.empty() )
continue; continue;
if ( isDslWs( curString[ 0 ] ) ) if ( isDslWs( curString[ 0 ] ) )

View file

@ -1155,12 +1155,6 @@ void expandOptionalParts( wstring & str, list< wstring > * result,
list< wstring > * headwords; list< wstring > * headwords;
headwords = inside_recurse ? result : &expanded; headwords = inside_recurse ? result : &expanded;
//if str is too long ,it can never be headwords.
//todo?
if( str.size() > 100 )
{
return;
}
for( ; x < str.size(); ) for( ; x < str.size(); )
{ {
wchar ch = str[ x ]; wchar ch = str[ x ];