diff --git a/btreeidx.cc b/btreeidx.cc index d9f5d9c8..8daebf1a 100644 --- a/btreeidx.cc +++ b/btreeidx.cc @@ -899,6 +899,11 @@ void IndexedWords::addWord( wstring const & word, uint32_t articleOffset ) wchar const * wordBegin = word.c_str(); 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 while( *wordBegin && Folding::isWhitespace( *wordBegin ) ) {