diff-match-patch-c icon indicating copy to clipboard operation
diff-match-patch-c copied to clipboard

Prepare a PR for https://github.com/arrbee/diff-match-patch-c/issues/5

Open udif opened this issue 8 years ago • 1 comments

OK, Here is a fix for the problem :-)

The problem was caused by the first loop in diff_cleanup_merge(). 'i' was used as the position for the current element, and updated to node->next at the end of each loop iteration. HOWEVER, some of the loop iterations have unallocated the current node pointed by 'i', effectively setting its 'next' element to point to the free store, thereby corrupting 'i'. The solution was to calculate the next 'i' and saving it at the beginning of the loop iteration.

udif avatar May 15 '16 22:05 udif

Thanks!

lenormf avatar Jun 09 '18 14:06 lenormf