From 5ef52a7e44c5e234053a8d9f76071f01f107abd2 Mon Sep 17 00:00:00 2001 From: leitner Date: Wed, 12 Sep 2012 20:20:42 +0000 Subject: [PATCH] catch more bad encoding --- scan/scan_utf8.c | 1 + 1 file changed, 1 insertion(+) diff --git a/scan/scan_utf8.c b/scan/scan_utf8.c index caa96a6..a0d68aa 100644 --- a/scan/scan_utf8.c +++ b/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; }