Browse Source

catch more bad encoding

master
Felix von Leitner 9 years ago
parent
commit
babeb35b1f
  1. 1
      scan/scan_utf8.c

1
scan/scan_utf8.c

@ -41,6 +41,7 @@ size_t scan_utf8(const char* in,size_t len,uint32_t* num) {
*/
m=(1<<(k*5-4+(k==2)));
while (k>1) {
if ((*in&0xc0)!=0x80) return 0;
i=(i<<6) | ((*in++)&0x3f);
--k;
}

Loading…
Cancel
Save