Fossil SCM
An extra long diff may occur in side-by-side or html mode as discussed in [forum post 49cc60131b](https://fossil-scm.org/forum/forumpost/49cc60131b). When enumerating mxr triples, looping over multiple triples may exceed mxr.
Commit
3c9472e56b7d8e021dc07b7de47377c1cdce195030e02423e620fa6868cda954
Parent
a402dd2a888d6d7…
1 file changed
+1
-1
+1
-1
| --- src/diff.c | ||
| +++ src/diff.c | ||
| @@ -2223,11 +2223,11 @@ | ||
| 2223 | 2223 | mxr = p->nEdit; |
| 2224 | 2224 | while( mxr>2 && R[mxr-1]==0 && R[mxr-2]==0 ){ mxr -= 3; } |
| 2225 | 2225 | |
| 2226 | 2226 | for(r=0; r<mxr; r += 3*nr){ |
| 2227 | 2227 | /* Figure out how many triples to show in a single block */ |
| 2228 | - for(nr=1; R[r+nr*3]>0 && R[r+nr*3]<(int)nContext*2; nr++){} | |
| 2228 | + for(nr=1; 3*nr<mxr && R[r+nr*3]>0 && R[r+nr*3]<(int)nContext*2; nr++){} | |
| 2229 | 2229 | |
| 2230 | 2230 | /* If there is a regex, skip this block (generate no diff output) |
| 2231 | 2231 | ** if the regex matches or does not match both insert and delete. |
| 2232 | 2232 | ** Only display the block if one side matches but the other side does |
| 2233 | 2233 | ** not. |
| 2234 | 2234 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -2223,11 +2223,11 @@ | |
| 2223 | mxr = p->nEdit; |
| 2224 | while( mxr>2 && R[mxr-1]==0 && R[mxr-2]==0 ){ mxr -= 3; } |
| 2225 | |
| 2226 | for(r=0; r<mxr; r += 3*nr){ |
| 2227 | /* Figure out how many triples to show in a single block */ |
| 2228 | for(nr=1; R[r+nr*3]>0 && R[r+nr*3]<(int)nContext*2; nr++){} |
| 2229 | |
| 2230 | /* If there is a regex, skip this block (generate no diff output) |
| 2231 | ** if the regex matches or does not match both insert and delete. |
| 2232 | ** Only display the block if one side matches but the other side does |
| 2233 | ** not. |
| 2234 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -2223,11 +2223,11 @@ | |
| 2223 | mxr = p->nEdit; |
| 2224 | while( mxr>2 && R[mxr-1]==0 && R[mxr-2]==0 ){ mxr -= 3; } |
| 2225 | |
| 2226 | for(r=0; r<mxr; r += 3*nr){ |
| 2227 | /* Figure out how many triples to show in a single block */ |
| 2228 | for(nr=1; 3*nr<mxr && R[r+nr*3]>0 && R[r+nr*3]<(int)nContext*2; nr++){} |
| 2229 | |
| 2230 | /* If there is a regex, skip this block (generate no diff output) |
| 2231 | ** if the regex matches or does not match both insert and delete. |
| 2232 | ** Only display the block if one side matches but the other side does |
| 2233 | ** not. |
| 2234 |