From 92354eea3ff8f07795c3ddb91cc6886c54578f10 Mon Sep 17 00:00:00 2001 From: "K.Kosako" Date: Fri, 12 Jul 2019 13:29:15 +0900 Subject: [PATCH] return real length for invalid byte sequence string --- src/gb18030.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gb18030.c b/src/gb18030.c index 7654432..8d415b0 100644 --- a/src/gb18030.c +++ b/src/gb18030.c @@ -2,7 +2,7 @@ gb18030.c - Oniguruma (regular expression library) **********************************************************************/ /*- - * Copyright (c) 2005-2018 KUBO Takehiro + * Copyright (c) 2005-2019 KUBO Takehiro * K.Kosako * All rights reserved. * @@ -67,11 +67,11 @@ gb18030_mbc_enc_len(const UChar* p) { if (GB18030_MAP[*p] != CM) return 1; + p++; if (GB18030_MAP[*p] == C4) return 4; - if (GB18030_MAP[*p] == C1) - return 1; /* illegal sequence */ + return 2; } -- 2.40.0