Limit length of search strings to prevent lockups.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19464

(cherry picked from commit 48bb6b137c)
This commit is contained in:
Jeff Young
2025-01-07 11:56:55 +00:00
parent 1d534303d4
commit 5ae377f41a
+6
View File
@@ -476,6 +476,12 @@ int EDA_COMBINED_MATCHER::ScoreTerms( std::vector<SEARCH_TERM>& aWeightedTerms )
if( !term.Normalized )
{
term.Text = term.Text.MakeLower().Trim( false ).Trim( true );
// Don't cause KiCad to hang if someone accidentally pastes the PCB or schematic
// into the search box.
if( term.Text.Length() > 5000 )
term.Text = term.Text.Left( 5000 );
term.Normalized = true;
}