krisk / Fuse

Lightweight fuzzy-search, in JavaScript
https://fusejs.io/
Apache License 2.0
18.1k stars 766 forks source link

False positive matches when pattern.length > 32 #136 #254 bugfix #333

Closed ErikLarsson82 closed 4 years ago

ErikLarsson82 commented 4 years ago

Solving these issues:

alexsaaf commented 4 years ago

Is it correct to assume that we can no longer get results with a pattern of length 32? Since the code is checking for patternLen <= 31?

ErikLarsson82 commented 4 years ago

No, @alexsaaf I just tried specifically pattern length of 31, 32, 33 in a local test and that worked fine. The fix is pretty crude and I found the break point by trial and error, "wrapping" before the overflow happens. I'd love to hear comments on the code if you have them.