mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 19:24:08 +00:00
Don't attempt adding very large words into index, they are usually a sign of malformed dictionary and can consume huge amount of resources.
This commit is contained in:
parent
79dbce2bb3
commit
004f9f9a36
|
@ -899,6 +899,11 @@ void IndexedWords::addWord( wstring const & word, uint32_t articleOffset )
|
||||||
wchar const * wordBegin = word.c_str();
|
wchar const * wordBegin = word.c_str();
|
||||||
string::size_type wordSize = word.size();
|
string::size_type wordSize = word.size();
|
||||||
|
|
||||||
|
// Safeguard us against various bugs here. Don't attempt adding words
|
||||||
|
// which are freakishly huge.
|
||||||
|
if ( wordSize > 256 )
|
||||||
|
return;
|
||||||
|
|
||||||
// Skip any leading whitespace
|
// Skip any leading whitespace
|
||||||
while( *wordBegin && Folding::isWhitespace( *wordBegin ) )
|
while( *wordBegin && Folding::isWhitespace( *wordBegin ) )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue