7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-21 00:21:25 +00:00

Limit length of search strings to prevent lockups.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19464
This commit is contained in:
Jeff Young 2025-01-02 17:03:43 +00:00
parent 520a7cf62c
commit 48bb6b137c

View File

@ -482,6 +482,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;
}