jkernech / google-diff-match-patch

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

An error in C++ code #35

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
There is an error in diff_match_patch.cpp on line 438:

436      if (!front) {
437        int k1 = delta - k2;
438        if (v2.contains(k2)) {
439          int x1 = v1.value(k1);

It should have been the following:

438        if (v1.contains(k1)) {

Original issue reported on code.google.com by snhere@gmail.com on 12 Jan 2011 at 1:25

GoogleCodeExporter commented 9 years ago
This bug went away in today's upload since all these lines were rewritten.  
I've confirmed that this error is not in the new versions of any of the 
language ports.

However I'm not closing this bug.  At issue is that none of the unit tests 
detected this.  That's not acceptable.

Thanks for catching this.  The latest version on Subversion is fixed.  It's 
also much faster.

Original comment by neil.fra...@gmail.com on 13 Jan 2011 at 1:37

GoogleCodeExporter commented 9 years ago
It turns out that the recent data structure change to v1/v2 makes this earlier 
error detectable by the existing unit tests.  When the error is recreated in 
the current code an out of range error is triggered.  Previously the hash was 
more forgiving.

Thus even if the error hadn't been inadvertently fixed in the previous upgrade, 
it would have been detected by the unit tests.

Closing.  No action needed.  Thanks for reporting this!

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