summaryrefslogtreecommitdiff
path: root/posix/regcomp.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2007-10-12 17:47:19 +0000
committerUlrich Drepper <drepper@redhat.com>2007-10-12 17:47:19 +0000
commitb7d1c5fa30247da1911913452b0ba89195638701 (patch)
tree3e43af2f95fb245cd0460f0418400d8773e4b4a0 /posix/regcomp.c
parentd074d36dde3140ba9b09555760dcbd503405d0f3 (diff)
* posix/fnmatch_loop.c: Take rule index returned as part of
findidx return value into account when accessing weights. * posix/regcomp.c: Likewise. * posix/regexec.c: Likewise.
Diffstat (limited to 'posix/regcomp.c')
-rw-r--r--posix/regcomp.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/posix/regcomp.c b/posix/regcomp.c
index 129546c32c..4cf168821c 100644
--- a/posix/regcomp.c
+++ b/posix/regcomp.c
@@ -3378,7 +3378,7 @@ build_equiv_class (bitset_t sbcset, const unsigned char *name)
/* Build single byte matcing table for this equivalence class. */
char_buf[1] = (unsigned char) '\0';
- len = weights[idx1];
+ len = weights[idx1 & 0xffffff];
for (ch = 0; ch < SBC_MAX; ++ch)
{
char_buf[0] = ch;
@@ -3390,11 +3390,15 @@ build_equiv_class (bitset_t sbcset, const unsigned char *name)
if (idx2 == 0)
/* This isn't a valid character. */
continue;
- if (len == weights[idx2])
+ /* Compare only if the length matches and the collation rule
+ index is the same. */
+ if (len == weights[idx2 & 0xffffff] && (idx1 >> 24) == (idx2 >> 24))
{
int cnt = 0;
+
while (cnt <= len &&
- weights[idx1 + 1 + cnt] == weights[idx2 + 1 + cnt])
+ weights[(idx1 & 0xffffff) + 1 + cnt]
+ == weights[(idx2 & 0xffffff) + 1 + cnt])
++cnt;
if (cnt > len)