Fossil SCM
If a file to be diffed contains an 0x00 character, consider it to be binary and do not attempt the diff.
Commit
334ab15270b814ac259b5787298f1e6b80edd81f
Parent
903af996f51b84d…
1 file changed
+1
+1
| --- src/diff.c | ||
| +++ src/diff.c | ||
| @@ -147,10 +147,11 @@ | ||
| 147 | 147 | /* Count the number of lines in the input file. Include the last line |
| 148 | 148 | ** in the count even if it lacks the \n terminator |
| 149 | 149 | */ |
| 150 | 150 | for(nLine=0, z2=z; (zNL = strchr(z2,'\n'))!=0; z2=zNL+1, nLine++){} |
| 151 | 151 | if( z2[0]!=0 ) nLine++; |
| 152 | + if( n!=(int)(z2-z) ) return 0; | |
| 152 | 153 | |
| 153 | 154 | a = fossil_malloc( sizeof(a[0])*nLine ); |
| 154 | 155 | memset(a, 0, sizeof(a[0])*nLine); |
| 155 | 156 | if( nLine==0 ){ |
| 156 | 157 | *pnLine = 0; |
| 157 | 158 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -147,10 +147,11 @@ | |
| 147 | /* Count the number of lines in the input file. Include the last line |
| 148 | ** in the count even if it lacks the \n terminator |
| 149 | */ |
| 150 | for(nLine=0, z2=z; (zNL = strchr(z2,'\n'))!=0; z2=zNL+1, nLine++){} |
| 151 | if( z2[0]!=0 ) nLine++; |
| 152 | |
| 153 | a = fossil_malloc( sizeof(a[0])*nLine ); |
| 154 | memset(a, 0, sizeof(a[0])*nLine); |
| 155 | if( nLine==0 ){ |
| 156 | *pnLine = 0; |
| 157 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -147,10 +147,11 @@ | |
| 147 | /* Count the number of lines in the input file. Include the last line |
| 148 | ** in the count even if it lacks the \n terminator |
| 149 | */ |
| 150 | for(nLine=0, z2=z; (zNL = strchr(z2,'\n'))!=0; z2=zNL+1, nLine++){} |
| 151 | if( z2[0]!=0 ) nLine++; |
| 152 | if( n!=(int)(z2-z) ) return 0; |
| 153 | |
| 154 | a = fossil_malloc( sizeof(a[0])*nLine ); |
| 155 | memset(a, 0, sizeof(a[0])*nLine); |
| 156 | if( nLine==0 ){ |
| 157 | *pnLine = 0; |
| 158 |