Mercurial > gnulib
changeset 17238:02e05b27fe6e
regex: check that pattern char is single-byte
Reported by Aharon Robbins in
<http://sourceware.org/ml/libc-alpha/2012-12/msg00456.html>.
* lib/regexec.c (check_node_accept_bytes):
Return 0 if the pattern string has a multibyte character here.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Sun, 30 Dec 2012 00:10:51 -0800 |
parents | 899138bc3a58 |
children | 7f224c8f6c75 |
files | ChangeLog lib/regexec.c |
diffstat | 2 files changed, 11 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Sat Dec 29 23:31:08 2012 -0800 +++ b/ChangeLog Sun Dec 30 00:10:51 2012 -0800 @@ -1,5 +1,11 @@ 2012-12-29 Paul Eggert <eggert@cs.ucla.edu> + regex: check that pattern char is single-byte + Reported by Aharon Robbins in + <http://sourceware.org/ml/libc-alpha/2012-12/msg00456.html>. + * 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 <http://sourceware.org/ml/libc-alpha/2012-12/msg00456.html>.
--- a/lib/regexec.c Sat Dec 29 23:31:08 2012 -0800 +++ b/lib/regexec.c Sun Dec 30 00:10:51 2012 -0800 @@ -3858,7 +3858,11 @@ 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) {