This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch master updated. glibc-2.27.9000-611-g786658a


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  786658a08829e8a303d846406812f9245846e99c (commit)
      from  2d5c41ded92bf1247ba2a29ad2074cf79dc15669 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=786658a08829e8a303d846406812f9245846e99c

commit 786658a08829e8a303d846406812f9245846e99c
Author: Florian Weimer <fweimer@redhat.com>
Date:   Fri Jul 20 11:58:51 2018 +0200

    regcomp: Fix off-by-one bug in build_equiv_class [BZ #23396]
    
    This bug is very similar to bug 23036: The existing code assumed that
    the length count included the length byte itself.
    
    Reviewed-by: Carlos O'Donell <carlos@redhat.com>

diff --git a/ChangeLog b/ChangeLog
index b45c83b..49d1377 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2018-07-20  Florian Weimer  <fweimer@redhat.com>
+
+	[BZ #23396]
+	* posix/regcomp.c (build_equiv_class): When comparing weights, do
+	not compare an extra byte after the end of the weights.
+
 2018-07-20  Samuel Thibault  <samuel.thibault@ens-lyon.org>
 
 	* sysdeps/mach/hurd/i386/tls.h (_hurd_tls_init): Set multiple_threads
diff --git a/posix/regcomp.c b/posix/regcomp.c
index 7b5ddaa..545d188 100644
--- a/posix/regcomp.c
+++ b/posix/regcomp.c
@@ -3531,18 +3531,10 @@ build_equiv_class (bitset_t sbcset, const unsigned char *name)
 	    continue;
 	  /* 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 & 0xffffff) + 1 + cnt]
-		     == weights[(idx2 & 0xffffff) + 1 + cnt])
-		++cnt;
-
-	      if (cnt > len)
-		bitset_set (sbcset, ch);
-	    }
+	  if (len == weights[idx2 & 0xffffff] && (idx1 >> 24) == (idx2 >> 24)
+	      && memcmp (weights + (idx1 & 0xffffff) + 1,
+			 weights + (idx2 & 0xffffff) + 1, len) == 0)
+	    bitset_set (sbcset, ch);
 	}
       /* Check whether the array has enough space.  */
       if (BE (*equiv_class_alloc == mbcset->nequiv_classes, 0))

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog       |    6 ++++++
 posix/regcomp.c |   16 ++++------------
 2 files changed, 10 insertions(+), 12 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]