sergi / go-diff

Diff, match and patch text in Go
MIT License
1.81k stars 207 forks source link

Trying to match a long pattern fails #119

Open adityasaky opened 3 years ago

adityasaky commented 3 years ago

Hello! I'm working with some longer pattern values, the value I'm currently testing has len(pattern) = ~800. I noticed that the line here: https://github.com/sergi/go-diff/blob/v1.2.0/diffmatchpatch/match.go#L57 causes an overflow beyond the length of the pattern being 64. I'm happy to help contribute fixes here if someone can point me in the right direction. I understand why it's happening but I haven't studied the algorithm yet to see if we can refactor this to accommodate larger patterns.

Thanks!

federicotdn commented 1 month ago

I've developed a variant of this library that can match patterns of any length: https://github.com/federicotdn/match2000 maybe it's useful!