Fossil SCM
Fix the comment formatter so that it does not crash with ill-formatted VT100 escapes.
Commit
2aa79ed7521b6c6c732ccd2a95d8b320557e5732cd219fad437de5ee56fdfa3d
Parent
2e9e3695ae6f837…
1 file changed
+6
-4
+6
-4
| --- src/comformat.c | ||
| +++ src/comformat.c | ||
| @@ -263,14 +263,16 @@ | ||
| 263 | 263 | int maxUTF8 = 1; /* Expected sequence length. */ |
| 264 | 264 | char c = z[i++]; |
| 265 | 265 | if( c==0x1b && z[i]=='[' ){ |
| 266 | 266 | do{ |
| 267 | 267 | i++; |
| 268 | - }while( fossil_isdigit(z[i]) || z[i]==';' ); | |
| 269 | - *pCchUTF8 = i+1; | |
| 270 | - *pUtf32 = 0x301; /* A zero-width character */ | |
| 271 | - return; | |
| 268 | + }while( i<fossil_isdigit(z[i]) || z[i]==';' ); | |
| 269 | + if( fossil_isalpha(z[i]) ){ | |
| 270 | + *pCchUTF8 = i+1; | |
| 271 | + *pUtf32 = 0x301; /* A zero-width character */ | |
| 272 | + return; | |
| 273 | + } | |
| 272 | 274 | } |
| 273 | 275 | if( (c&0x80)==0x00 ){ /* 7-bit ASCII character. */ |
| 274 | 276 | *pCchUTF8 = 1; |
| 275 | 277 | *pUtf32 = (int)z[0]; |
| 276 | 278 | return; |
| 277 | 279 |
| --- src/comformat.c | |
| +++ src/comformat.c | |
| @@ -263,14 +263,16 @@ | |
| 263 | int maxUTF8 = 1; /* Expected sequence length. */ |
| 264 | char c = z[i++]; |
| 265 | if( c==0x1b && z[i]=='[' ){ |
| 266 | do{ |
| 267 | i++; |
| 268 | }while( fossil_isdigit(z[i]) || z[i]==';' ); |
| 269 | *pCchUTF8 = i+1; |
| 270 | *pUtf32 = 0x301; /* A zero-width character */ |
| 271 | return; |
| 272 | } |
| 273 | if( (c&0x80)==0x00 ){ /* 7-bit ASCII character. */ |
| 274 | *pCchUTF8 = 1; |
| 275 | *pUtf32 = (int)z[0]; |
| 276 | return; |
| 277 |
| --- src/comformat.c | |
| +++ src/comformat.c | |
| @@ -263,14 +263,16 @@ | |
| 263 | int maxUTF8 = 1; /* Expected sequence length. */ |
| 264 | char c = z[i++]; |
| 265 | if( c==0x1b && z[i]=='[' ){ |
| 266 | do{ |
| 267 | i++; |
| 268 | }while( i<fossil_isdigit(z[i]) || z[i]==';' ); |
| 269 | if( fossil_isalpha(z[i]) ){ |
| 270 | *pCchUTF8 = i+1; |
| 271 | *pUtf32 = 0x301; /* A zero-width character */ |
| 272 | return; |
| 273 | } |
| 274 | } |
| 275 | if( (c&0x80)==0x00 ){ /* 7-bit ASCII character. */ |
| 276 | *pCchUTF8 = 1; |
| 277 | *pUtf32 = (int)z[0]; |
| 278 | return; |
| 279 |