Fossil SCM
Detect overlong and nul-bytes for files starting with utf-16 BOM but with odd number of bytes.
Commit
14019cb0e241f9761ee18d254feedf18c8eb45b7
Parent
32b8fc7dcddf689…
1 file changed
+1
+1
| --- src/diff.c | ||
| +++ src/diff.c | ||
| @@ -332,10 +332,11 @@ | ||
| 332 | 332 | int j, c, result = 1; /* Assume UTF-16 text, prove otherwise */ |
| 333 | 333 | |
| 334 | 334 | if( pFlags ) *pFlags = LOOK_NONE; |
| 335 | 335 | if( n==0 ) return result; /* Empty file -> text */ |
| 336 | 336 | if( n%2 ){ |
| 337 | + looks_like_utf8(pContent, pFlags); | |
| 337 | 338 | if( pFlags ) *pFlags |= LOOK_ODD; |
| 338 | 339 | return 0; /* Odd number of bytes -> binary (or UTF-8) */ |
| 339 | 340 | } |
| 340 | 341 | c = *z; |
| 341 | 342 | if( c==0 ){ |
| 342 | 343 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -332,10 +332,11 @@ | |
| 332 | int j, c, result = 1; /* Assume UTF-16 text, prove otherwise */ |
| 333 | |
| 334 | if( pFlags ) *pFlags = LOOK_NONE; |
| 335 | if( n==0 ) return result; /* Empty file -> text */ |
| 336 | if( n%2 ){ |
| 337 | if( pFlags ) *pFlags |= LOOK_ODD; |
| 338 | return 0; /* Odd number of bytes -> binary (or UTF-8) */ |
| 339 | } |
| 340 | c = *z; |
| 341 | if( c==0 ){ |
| 342 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -332,10 +332,11 @@ | |
| 332 | int j, c, result = 1; /* Assume UTF-16 text, prove otherwise */ |
| 333 | |
| 334 | if( pFlags ) *pFlags = LOOK_NONE; |
| 335 | if( n==0 ) return result; /* Empty file -> text */ |
| 336 | if( n%2 ){ |
| 337 | looks_like_utf8(pContent, pFlags); |
| 338 | if( pFlags ) *pFlags |= LOOK_ODD; |
| 339 | return 0; /* Odd number of bytes -> binary (or UTF-8) */ |
| 340 | } |
| 341 | c = *z; |
| 342 | if( c==0 ){ |
| 343 |