]> Savannah Git Hosting - gnulib.git/commitdiff
regex: check that pattern char is single-byte
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 30 Dec 2012 08:10:51 +0000 (00:10 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 30 Dec 2012 08:13:16 +0000 (00:13 -0800)
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.

ChangeLog
lib/regexec.c

index 8c61adb6807b080497aba5c08a3fcb2b4cfade01..0c3c7f12eafe92cd86568cb57d42f5df04c6780a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>.
index 22e8dd67c4c35bde1c2e3197c01a66205e2989d7..b10efb3a934be0df4d8546640e03275d02335f0e 100644 (file)
@@ -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)
     {