catch more bad encoding

master
leitner 12 years ago
parent cdb07d6d95
commit 5ef52a7e44

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

Loading…
Cancel
Save