loewensteinph / google-diff-match-patch

Automatically exported from code.google.com/p/google-diff-match-patch
Apache License 2.0
0 stars 0 forks source link

An error in C++ and Java implementation of diff_cleanupSemantic #36

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
A pointer to the previous Diff is only assigned once and never advances.

Try to double delete/insert pair in the test for overlap elimination:
<del>abcxx</del><ins>xxdef</ins><del>abcxx</del><ins>xxdef</ins>

Original issue reported on code.google.com by snhere@gmail.com on 14 Jan 2011 at 9:22

GoogleCodeExporter commented 8 years ago
Confirmed.  Thank you!  Wow, that's a rather embarrassing omission.  It's also 
a lesson that having 100% code coverage in tests is not a guarantee of 
correctness.

All languages using linked lists of diffs are affected:
  C++, Java
Languages which use indexed arrays of diffs are fine:
  C#, JavaScript, Lua, Python, Objective C (not released yet)

For the record, the nature of this bug is non-critical.  The output is 
completely valid, though the output is non-optimal.

Corrections have been made to the offending languages, a new unit test has been 
made for all languages, and the changes have been sent off for code review.  
Expect it to land on Wednesday or Friday.

Original comment by neil.fra...@gmail.com on 19 Jan 2011 at 2:42

GoogleCodeExporter commented 8 years ago
New version has been uploaded.  Thanks for catching this.

Original comment by neil.fra...@gmail.com on 19 Jan 2011 at 9:37