From 073f7ec76c8a3836d7706d2b57df6efa6966fa39 Mon Sep 17 00:00:00 2001 From: Steve Bennett Date: Wed, 7 Dec 2011 18:05:57 +1000 Subject: Fix a regexp infinite loop on bad utf-8 input regsub {\mdnl\M.*$} "word \xA9 another word" "" line Signed-off-by: Steve Bennett --- jimregexp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'jimregexp.c') diff --git a/jimregexp.c b/jimregexp.c index e904db8..2f57caf 100644 --- a/jimregexp.c +++ b/jimregexp.c @@ -1132,7 +1132,10 @@ nextline: if (*s == '\0') { break; } - s += utf8_charlen(*s); + else { + int c; + s += utf8_tounicode(s, &c); + } } /* Failure. */ -- cgit v1.1