]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix regex wctype namespace (bug 18495).
authorJoseph Myers <joseph@codesourcery.com>
Fri, 5 Jun 2015 20:04:47 +0000 (20:04 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Fri, 5 Jun 2015 20:04:47 +0000 (20:04 +0000)
regcomp brings in references to various wctype functions that aren't
in all the standards including regcomp.  This patch fixes this in the
usual way by using the __* versions of these functions (which already
exist, but some didn't have libc_hidden_proto / libc_hidden_def
before).

Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch).  (Other wide character
function references from the regex code mean that this patch by itself
doesn't fix any XFAILed linknamespace test failures; further patches
will be needed for that.)

[BZ #18495]
* wctype/wcfuncs.c (__iswalnum): Use libc_hidden_def.
(__iswlower): Likewise.
* include/wctype.h (__iswalnum): Declare.  Use libc_hidden_proto.
(__iswlower): Likewise.
* posix/regcomp.c (re_compile_fastmap_iter): Call __towlower
instead of towlower.
* posix/regex_internal.c (build_wcs_upper_buffer): Call __iswlower
instead of iswlower.  Call __towupper instead of towupper.
* posix/regex_internal.h (IS_WIDE_WORD_CHAR): Call __iswalnum
instead of iswalnum.

ChangeLog
NEWS
include/wctype.h
posix/regcomp.c
posix/regex_internal.c
posix/regex_internal.h
wctype/wcfuncs.c

index b4605e2223df382a3f9018e41960d74caf1da432..1ebd443ef29f01d4ab267d244feed953cf3b44d2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2015-06-05  Joseph Myers  <joseph@codesourcery.com>
+
+       [BZ #18495]
+       * wctype/wcfuncs.c (__iswalnum): Use libc_hidden_def.
+       (__iswlower): Likewise.
+       * include/wctype.h (__iswalnum): Declare.  Use libc_hidden_proto.
+       (__iswlower): Likewise.
+       * posix/regcomp.c (re_compile_fastmap_iter): Call __towlower
+       instead of towlower.
+       * posix/regex_internal.c (build_wcs_upper_buffer): Call __iswlower
+       instead of iswlower.  Call __towupper instead of towupper.
+       * posix/regex_internal.h (IS_WIDE_WORD_CHAR): Call __iswalnum
+       instead of iswalnum.
+
 2015-06-05  Tulio Magno Quites Machado Filho  <tuliom@linux.vnet.ibm.com>
 
        * malloc/tst-malloc-backtrace.c (do_test): Redirect libc fatal
diff --git a/NEWS b/NEWS
index 8a16e3f49492f10716fe30141c5ce53e886ca5ae..5537dedb3906f5aa497d61a96ce2ad39ee24f70b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -20,7 +20,7 @@ Version 2.22
   18111, 18116, 18125, 18128, 18138, 18185, 18196, 18197, 18206, 18210,
   18211, 18217, 18220, 18221, 18234, 18244, 18247, 18287, 18319, 18324,
   18333, 18346, 18397, 18409, 18410, 18412, 18418, 18422, 18434, 18444,
-  18468, 18469, 18470.
+  18468, 18469, 18470, 18495.
 
 * Cache information can be queried via sysconf() function on s390 e.g. with
   _SC_LEVEL1_ICACHE_SIZE as argument.
index 88c78e62a02db4ef015443aaf84b8b58e1f71db6..a71b10377b21a1cb4aa6aa9a18c39cd67f4134d3 100644 (file)
@@ -46,11 +46,13 @@ extern wctype_t __wctype (const char *__property);
 extern wctrans_t __wctrans (const char *__property);
 extern wint_t __towctrans (wint_t __wc, wctrans_t __desc);
 
+extern __typeof (iswalnum) __iswalnum __THROW __attribute_pure__;
 extern __typeof (iswalnum_l) __iswalnum_l;
 extern __typeof (iswalpha_l) __iswalpha_l;
 extern __typeof (iswblank_l) __iswblank_l;
 extern __typeof (iswcntrl_l) __iswcntrl_l;
 extern __typeof (iswdigit_l) __iswdigit_l;
+extern __typeof (iswlower) __iswlower __THROW __attribute_pure__;
 extern __typeof (iswlower_l) __iswlower_l;
 extern __typeof (iswgraph_l) __iswgraph_l;
 extern __typeof (iswprint_l) __iswprint_l;
@@ -65,11 +67,13 @@ extern __typeof (towupper) __towupper __THROW __attribute_pure__;
 
 libc_hidden_proto (__towctrans)
 libc_hidden_proto (__iswctype)
+libc_hidden_proto (__iswalnum)
 libc_hidden_proto (__iswalnum_l)
 libc_hidden_proto (__iswalpha_l)
 libc_hidden_proto (__iswblank_l)
 libc_hidden_proto (__iswcntrl_l)
 libc_hidden_proto (__iswdigit_l)
+libc_hidden_proto (__iswlower)
 libc_hidden_proto (__iswlower_l)
 libc_hidden_proto (__iswgraph_l)
 libc_hidden_proto (__iswprint_l)
index 0adde3d4a8e5e956ac44f8f13b7334794c673a35..728c48239f0efceec280916a144160a7035b870e 100644 (file)
@@ -334,7 +334,7 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state,
              memset (&state, '\0', sizeof (state));
              if (__mbrtowc (&wc, (const char *) buf, p - buf,
                             &state) == p - buf
-                 && (__wcrtomb ((char *) buf, towlower (wc), &state)
+                 && (__wcrtomb ((char *) buf, __towlower (wc), &state)
                      != (size_t) -1))
                re_set_fastmap (fastmap, 0, buf[0]);
            }
@@ -410,7 +410,7 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state,
                    re_set_fastmap (fastmap, icase, *(unsigned char *) buf);
                  if ((bufp->syntax & RE_ICASE) && dfa->mb_cur_max > 1)
                    {
-                     if (__wcrtomb (buf, towlower (cset->mbchars[i]), &state)
+                     if (__wcrtomb (buf, __towlower (cset->mbchars[i]), &state)
                          != (size_t) -1)
                        re_set_fastmap (fastmap, false, *(unsigned char *) buf);
                    }
index e5a14cde204806d1363c72663a787796e41b981d..d77d3a14dce6878241a685726961940385494bea 100644 (file)
@@ -312,11 +312,11 @@ build_wcs_upper_buffer (re_string_t *pstr)
          if (BE (mbclen + 2 > 2, 1))
            {
              wchar_t wcu = wc;
-             if (iswlower (wc))
+             if (__iswlower (wc))
                {
                  size_t mbcdlen;
 
-                 wcu = towupper (wc);
+                 wcu = __towupper (wc);
                  mbcdlen = wcrtomb (buf, wcu, &prev_st);
                  if (BE (mbclen == mbcdlen, 1))
                    memcpy (pstr->mbs + byte_idx, buf, mbclen);
@@ -382,11 +382,11 @@ build_wcs_upper_buffer (re_string_t *pstr)
        if (BE (mbclen + 2 > 2, 1))
          {
            wchar_t wcu = wc;
-           if (iswlower (wc))
+           if (__iswlower (wc))
              {
                size_t mbcdlen;
 
-               wcu = towupper (wc);
+               wcu = __towupper (wc);
                mbcdlen = wcrtomb ((char *) buf, wcu, &prev_st);
                if (BE (mbclen == mbcdlen, 1))
                  memcpy (pstr->mbs + byte_idx, buf, mbclen);
index 7fc6d524e98dcea2a7c44f4b76c25dc6168e6b76..154e96999dd7f788adbdd192bf12608d7bd3509a 100644 (file)
@@ -471,7 +471,7 @@ typedef struct bin_tree_storage_t bin_tree_storage_t;
 
 #define IS_WORD_CHAR(ch) (isalnum (ch) || (ch) == '_')
 #define IS_NEWLINE(ch) ((ch) == NEWLINE_CHAR)
-#define IS_WIDE_WORD_CHAR(ch) (iswalnum (ch) || (ch) == L'_')
+#define IS_WIDE_WORD_CHAR(ch) (__iswalnum (ch) || (ch) == L'_')
 #define IS_WIDE_NEWLINE(ch) ((ch) == WIDE_NEWLINE_CHAR)
 
 #define NOT_SATISFY_PREV_CONSTRAINT(constraint,context) \
index 788fed9a6ac7f706af2a5b43f83e5e5f997d9a84..e7c0308d6d10ea8aab1cc70e85f1cf008d768c63 100644 (file)
@@ -38,6 +38,7 @@
 
 #undef iswalnum
 func (alnum, __ISwalnum)
+libc_hidden_def (__iswalnum)
 libc_hidden_weak (iswalnum)
 #undef iswalpha
 func (alpha, __ISwalpha)
@@ -51,6 +52,7 @@ func (digit, __ISwdigit)
 libc_hidden_weak (iswdigit)
 #undef iswlower
 func (lower, __ISwlower)
+libc_hidden_def (__iswlower)
 libc_hidden_weak (iswlower)
 #undef iswgraph
 func (graph, __ISwgraph)