Fossil SCM

Fix handling of byte sequence \xF4\x00 in utf-8 validation. Now all tests pass again. Thanks to Scott Robinson for discovering this!

jan.nijtmans 2016-06-13 08:29 trunk
Commit 5684672ab72780f7fe5f6c1909ae3a6e21f21997
1 file changed +1 -1
+1 -1
--- src/lookslike.c
+++ src/lookslike.c
@@ -157,11 +157,11 @@
157157
c = *z;
158158
while( --n>0 ){
159159
c2 = c;
160160
c = *++z;
161161
if( c2>=0x80 ){
162
- if( ((c2<0xc2) || (c2>=0xf4) || ((c&0xc0)!=0x80)) &&
162
+ if( ((c&0xc0)!=0x80) || ((c2<0xc2) || (c2>=0xf4)) &&
163163
(((c2!=0xf4) || (c>=0x90)) && ((c2!=0xc0) || (c!=0x80))) ){
164164
return LOOK_INVALID; /* Invalid UTF-8 */
165165
}
166166
if( c2>=0xe0 ){
167167
if ((c2==0xf0 && c<0x90)||(c2==0xe0 && c<0xa0)){
168168
--- src/lookslike.c
+++ src/lookslike.c
@@ -157,11 +157,11 @@
157 c = *z;
158 while( --n>0 ){
159 c2 = c;
160 c = *++z;
161 if( c2>=0x80 ){
162 if( ((c2<0xc2) || (c2>=0xf4) || ((c&0xc0)!=0x80)) &&
163 (((c2!=0xf4) || (c>=0x90)) && ((c2!=0xc0) || (c!=0x80))) ){
164 return LOOK_INVALID; /* Invalid UTF-8 */
165 }
166 if( c2>=0xe0 ){
167 if ((c2==0xf0 && c<0x90)||(c2==0xe0 && c<0xa0)){
168
--- src/lookslike.c
+++ src/lookslike.c
@@ -157,11 +157,11 @@
157 c = *z;
158 while( --n>0 ){
159 c2 = c;
160 c = *++z;
161 if( c2>=0x80 ){
162 if( ((c&0xc0)!=0x80) || ((c2<0xc2) || (c2>=0xf4)) &&
163 (((c2!=0xf4) || (c>=0x90)) && ((c2!=0xc0) || (c!=0x80))) ){
164 return LOOK_INVALID; /* Invalid UTF-8 */
165 }
166 if( c2>=0xe0 ){
167 if ((c2==0xf0 && c<0x90)||(c2==0xe0 && c<0xa0)){
168

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button