Fossil

Check-in [2aa79ed752]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix the comment formatter so that it does not crash with ill-formatted VT100 escapes.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 2aa79ed7521b6c6c732ccd2a95d8b320557e5732cd219fad437de5ee56fdfa3d
User & Date: drh 2025-02-26 21:03:37.702
Context
2025-02-27
01:50
Extend the fuzzer to have the ability to run comment_print(). check-in: 8639f9b2d5 user: drh tags: trunk
2025-02-26
21:03
Fix the comment formatter so that it does not crash with ill-formatted VT100 escapes. check-in: 2aa79ed752 user: drh tags: trunk
19:44
Honor the "y=h" query option on the /search page even if help-search is disabled, but otherwise do not advertise help-search when it is disabled. check-in: 2e9e3695ae user: drh tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/comformat.c.
261
262
263
264
265
266
267
268

269
270
271

272
273
274
275
276
277
278
  int i = 0;                              /* Counted bytes. */
  int cchUTF8 = 1;                        /* Code units consumed. */
  int maxUTF8 = 1;                        /* Expected sequence length. */
  char c = z[i++];
  if( c==0x1b && z[i]=='[' ){
    do{
      i++;
    }while( fossil_isdigit(z[i]) || z[i]==';' );

    *pCchUTF8 = i+1;
    *pUtf32 = 0x301;  /* A zero-width character */
    return;

  }
  if( (c&0x80)==0x00 ){                   /* 7-bit ASCII character. */
    *pCchUTF8 = 1;
    *pUtf32 = (int)z[0];
    return;
  }
  else if( (c&0xe0)==0xc0 ) maxUTF8 = 2;  /* UTF-8 lead byte 110vvvvv */







|
>
|
|
|
>







261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
  int i = 0;                              /* Counted bytes. */
  int cchUTF8 = 1;                        /* Code units consumed. */
  int maxUTF8 = 1;                        /* Expected sequence length. */
  char c = z[i++];
  if( c==0x1b && z[i]=='[' ){
    do{
      i++;
    }while( i<fossil_isdigit(z[i]) || z[i]==';' );
    if( fossil_isalpha(z[i]) ){
      *pCchUTF8 = i+1;
      *pUtf32 = 0x301;  /* A zero-width character */
      return;
    }
  }
  if( (c&0x80)==0x00 ){                   /* 7-bit ASCII character. */
    *pCchUTF8 = 1;
    *pUtf32 = (int)z[0];
    return;
  }
  else if( (c&0xe0)==0xc0 ) maxUTF8 = 2;  /* UTF-8 lead byte 110vvvvv */