catch more bad encoding

This commit is contained in:
leitner 2012-09-12 20:20:42 +00:00
parent cdb07d6d95
commit 5ef52a7e44

View File

@ -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;
}