mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 23:34: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 );
|
wstring removed( str, 0, x );
|
||||||
|
|
||||||
|
// Limit the amount of results to avoid excessive resource consumption
|
||||||
|
if ( result.size() < 32 )
|
||||||
result.push_back( removed );
|
result.push_back( removed );
|
||||||
|
else
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -949,6 +953,8 @@ void expandOptionalParts( wstring & str, list< wstring > & result,
|
||||||
++x;
|
++x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Limit the amount of results to avoid excessive resource consumption
|
||||||
|
if ( result.size() < 32 )
|
||||||
result.push_back( str );
|
result.push_back( str );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue