curran / curran/google-diff-match-patch

BAD_ACCESS error in Objective-C when Diff_Timeout == 0 or > 6

Open
#64 0 comments 0 reactions 0 assignees View on GitHub
auto-migrated Priority-Medium Type-Defect
Dominant language
Python
Stars
17
Forks
2
PR merge metrics
No merged PRs in 30d

Description

```
What steps will reproduce the problem?
1. Iterate thru a list of text files to compare and prepare diff ranges

2. For each file diff are obtained as below:
DiffMatchPatch* dmp = [DiffMatchPatch new];
dmp.Diff_TimeOut = 0;
NSMutableArray* diffs = [dmp diff_mainOfOldString:oldContent
andNewString:newContent];
// [dmp diff_cleanupEfficiency:diffs];

3. Sufficiently (around 214,000 chars, 34,00 words in 706 lines) large text
file with changes to last more than 6 seconds

What is the expected output? What do you see instead?
Expected: around 126 diffs
Actual:
BAD_ACCESS error @ DiffMatchPatch.m
diff_bisectOfOldString:andNewString:deadline:
line:677
676: for (CFIndex x = 0; x < v_length; x++) {
677: v1[x] = -1;
678: v2[x] = -1;
679: }

What version of the product are you using? On what operating system?
Product Version:diff_match_patch_20120106 (and also in the previous one)
OS: Mac OS X 10.7.2, 64 bit, XCode 4.2, iMac 23"

Please provide any additional information below.
- This happens only when iterating over a list of files (around 300)
- When the problem file in run individually, NO error
- Also works fine in Java
- Diff_TimeOut < 6, works with multi file iteration, but produces coarse diff
ranges. We need finer ranges and hence Diff_Timeout is set to zero.
- My $0.02 ==> Seems an issue if the
DiffMatchPatch.diff_bisectOfOldString:andNewString:deadline: is recursed more
than 5 times

```

Original issue reported on code.google.com by `ampras...@gmail.com` on 4 Feb 2012 at 9:16

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.