Fossil

Check-in [5684672a]
Login

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

Overview
Comment:Fix handling of byte sequence \xF4\x00 in utf-8 validation. Now all tests pass again. Thanks to Scott Robison for discovering this!
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:5684672ab72780f7fe5f6c1909ae3a6e21f21997
User & Date: jan.nijtmans 2016-06-13 08:29:06
Original Comment: Fix handling of byte sequence \xF4\x00 in utf-8 validation. Now all tests pass again. Thanks to Scott Robinson for discovering this!
Context
2016-06-14
07:43
Eliminate (harmless) compiler warning check-in: e449ede3 user: jan.nijtmans tags: trunk
05:00
merged from trunk check-in: d22c72bc user: sdr tags: invalid_utf8_table
2016-06-13
08:29
Fix handling of byte sequence \xF4\x00 in utf-8 validation. Now all tests pass again. Thanks to Scott Robison for discovering this! check-in: 5684672a user: jan.nijtmans tags: trunk
2016-06-11
20:13
For the "setenv:" line of CGI scripts, if the VALUE field is omitted, unset the variable. check-in: 72df287c user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/lookslike.c.

155
156
157
158
159
160
161
162
163
164
165
166
167
168
169

  if( n==0 ) return 0;  /* Empty file -> OK */
  c = *z;
  while( --n>0 ){
    c2 = c;
    c = *++z;
    if( c2>=0x80 ){
      if( ((c2<0xc2) || (c2>=0xf4) || ((c&0xc0)!=0x80)) &&
          (((c2!=0xf4) || (c>=0x90)) && ((c2!=0xc0) || (c!=0x80))) ){
        return LOOK_INVALID; /* Invalid UTF-8 */
      }
      if( c2>=0xe0 ){
        if ((c2==0xf0 && c<0x90)||(c2==0xe0 && c<0xa0)){
          return LOOK_INVALID; /* Invalid UTF-8, too short */
        }







|







155
156
157
158
159
160
161
162
163
164
165
166
167
168
169

  if( n==0 ) return 0;  /* Empty file -> OK */
  c = *z;
  while( --n>0 ){
    c2 = c;
    c = *++z;
    if( c2>=0x80 ){
      if( ((c&0xc0)!=0x80) || ((c2<0xc2) || (c2>=0xf4)) &&
          (((c2!=0xf4) || (c>=0x90)) && ((c2!=0xc0) || (c!=0x80))) ){
        return LOOK_INVALID; /* Invalid UTF-8 */
      }
      if( c2>=0xe0 ){
        if ((c2==0xf0 && c<0x90)||(c2==0xe0 && c<0xa0)){
          return LOOK_INVALID; /* Invalid UTF-8, too short */
        }