From: Paul Eggert Date: Sun, 30 Dec 2012 08:10:51 +0000 (-0800) Subject: regex: check that pattern char is single-byte X-Git-Tag: v0.1~291 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=569f41015cbba5b185dc1e4655c801fb61302d10;p=gnulib.git regex: check that pattern char is single-byte Reported by Aharon Robbins in . * lib/regexec.c (check_node_accept_bytes): Return 0 if the pattern string has a multibyte character here. --- diff --git a/ChangeLog b/ChangeLog index 8c61adb680..0c3c7f12ea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2012-12-29 Paul Eggert + regex: check that pattern char is single-byte + Reported by Aharon Robbins in + . + * lib/regexec.c (check_node_accept_bytes): + Return 0 if the pattern string has a multibyte character here. + regex: implement rational ranges Reported by Aharon Robbins in . diff --git a/lib/regexec.c b/lib/regexec.c index 22e8dd67c4..b10efb3a93 100644 --- a/lib/regexec.c +++ b/lib/regexec.c @@ -3858,7 +3858,11 @@ check_node_accept_bytes (const re_dfa_t *dfa, Idx node_idx, elem_len = re_string_elem_size_at (input, str_idx); if ((elem_len <= 1 && char_len <= 1) || char_len == 0) - return 0; + { + wint_t wc = __btowc (input->mbs[str_idx]); + if (wc < SBC_MAX && wc != WEOF) + return 0; + } if (node->type == COMPLEX_BRACKET) {