From c596e023b75e2e17a9b338ac0ba09a51fd5995a9 Mon Sep 17 00:00:00 2001 From: Steve Bennett Date: Fri, 1 Nov 2019 16:56:20 +1000 Subject: regexp,regsub: utf8: Fix incorrect count with . matches Internally bytes were being counted rather than characters Reported-by: dbohdan Signed-off-by: Steve Bennett --- jimregexp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'jimregexp.c') diff --git a/jimregexp.c b/jimregexp.c index 3771bd7..5b2d60c 100644 --- a/jimregexp.c +++ b/jimregexp.c @@ -1612,10 +1612,9 @@ static int regrepeat(regex_t *preg, int p, int max) opnd = OPERAND(p); switch (OP(preg, p)) { case ANY: - /* No need to handle utf8 specially here */ while (!reg_iseol(preg, *scan) && count < max) { count++; - scan++; + scan += utf8_charlen(*scan); } break; case EXACTLY: -- cgit v1.1