sergi / go-diff

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

fix panic: runtime error: slice bounds out of range #128

Open iambus opened 2 years ago

iambus commented 2 years ago

This PR should fix #127

The new code uses same implementation as the Java version: https://github.com/google/diff-match-patch/blob/62f2e689f498f9c92dbc588c58750addec9b1654/java/src/name/fraser/neil/plaintext/diff_match_patch.java#L545 https://github.com/google/diff-match-patch/blob/62f2e689f498f9c92dbc588c58750addec9b1654/java/src/name/fraser/neil/plaintext/diff_match_patch.java#L568

meghb commented 2 years ago

Any updates on getting this merged? Ran into same panic as reported in #127

dokudoki commented 2 years ago

@iambus Thank you! still waiting for a merge.

michelpapi commented 2 years ago

One of the unit-tests (TestDiffCharsToLines) panics with this change

iambus commented 1 year ago

One of the unit-tests (TestDiffCharsToLines) panics with this change

Tests were updated.