Fails if the pattern is of length 0
zacps opened this issue · comments
Zac Pullar-Strecker commented
The problematic line is here.
final mask = 1 << (patternLen <= 31 ? patternLen - 1 : 30);
If patternLen = 0
then (patternLen <= 31 ? patternLen - 1 : 30)=-1
which promptly fails the shift.
Igor Borges commented
Hey again @zacps, thanks for pointing this!
Could you open a PR fixing this issue? I'd greatly appreaciate it!