From: Stanislav Brabec Date: Fri, 24 Feb 2012 20:24:44 +0000 (-0800) Subject: regex: fix false multibyte matches in some regular expressions X-Git-Tag: v0.1~1139 X-Git-Url: http://erislabs.net/gitweb/?a=commitdiff_plain;h=1997177209382391a38d061f234fe04c74b863da;p=gnulib.git regex: fix false multibyte matches in some regular expressions See and . * lib/regex_internal.c (re_string_skip_chars): Fix miscomputation of remain_len that may cause incomplete multi-byte character and false match. --- diff --git a/ChangeLog b/ChangeLog index 681d77344..53680d83c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2012-02-24 Stanislav Brabec (tiny change) + + regex: fix false multibyte matches in some regular expressions + See + and . + * lib/regex_internal.c (re_string_skip_chars): + Fix miscomputation of remain_len that may cause incomplete + multi-byte character and false match. + 2012-02-24 Jim Meyering maint.mk: tell sc_prohibit_strcmp to ding "0 == strcmp (...)", too diff --git a/lib/regex_internal.c b/lib/regex_internal.c index aa140334c..7e8c1bc25 100644 --- a/lib/regex_internal.c +++ b/lib/regex_internal.c @@ -498,7 +498,7 @@ re_string_skip_chars (re_string_t *pstr, Idx new_raw_idx, wint_t *last_wc) rawbuf_idx < new_raw_idx;) { wchar_t wc2; - Idx remain_len = pstr->len - rawbuf_idx; + Idx remain_len = pstr->raw_len - rawbuf_idx; prev_st = pstr->cur_state; mbclen = __mbrtowc (&wc2, (const char *) pstr->raw_mbs + rawbuf_idx, remain_len, &pstr->cur_state);