mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 00:14:06 +00:00
Limit the number of expanded optional parts in DSL to at most 32 to prevent resource exhaustion.
This commit is contained in:
parent
7778a8562a
commit
014731fa85
|
@ -930,7 +930,11 @@ void expandOptionalParts( wstring & str, list< wstring > & result,
|
|||
|
||||
wstring removed( str, 0, x );
|
||||
|
||||
result.push_back( removed );
|
||||
// Limit the amount of results to avoid excessive resource consumption
|
||||
if ( result.size() < 32 )
|
||||
result.push_back( removed );
|
||||
else
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -949,7 +953,9 @@ void expandOptionalParts( wstring & str, list< wstring > & result,
|
|||
++x;
|
||||
}
|
||||
|
||||
result.push_back( str );
|
||||
// Limit the amount of results to avoid excessive resource consumption
|
||||
if ( result.size() < 32 )
|
||||
result.push_back( str );
|
||||
}
|
||||
|
||||
void expandTildes( wstring & str, wstring const & tildeReplacement )
|
||||
|
|
Loading…
Reference in a new issue