Skip to content
Myr

Do not allow very long queries in FuzzyMatchV2

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Close #4608

authored by Junegunn Choi · committed by Junegunn Choi · parent 1d5e87f · Browse files · 1 file+3 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+3 added−1 removed

  • other:+3 added−1 removed

1 file+3 added−1 removed

modified:src/algo/algo.go+3 added-1 removed
443 unmodified lines
444 }445446 // Since O(nm) algorithm can be prohibitively expensive for large input,447 // we fall back to the greedy algorithm.448 // Also, we should not allow a very long pattern to avoid 16-bit integer449 // overflow in the score matrix. 1000 is a safe limit.448 if slab != nil && N*M > cap(slab.I16) {450 if slab != nil && N*M > cap(slab.I16) || M > 1000 {451 return FuzzyMatchV1(caseSensitive, normalize, forward, input, pattern, withPos, slab)452 }453454 // Phase 1. Optimized search for ASCII string
580 unmodified lines