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.17-857-gbb5bb87


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  bb5bb87cd2aa7462c88a11c69aa736ca62fd7cd8 (commit)
      from  fc74328c1f51955bd5f108485aad52bb9c2fa0d0 (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=bb5bb87cd2aa7462c88a11c69aa736ca62fd7cd8

commit bb5bb87cd2aa7462c88a11c69aa736ca62fd7cd8
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Jun 26 15:23:08 2013 -0700

    Add a test for BZ #15674

diff --git a/ChangeLog b/ChangeLog
index fd3a90f..37db6c0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,9 @@
 2013-06-26  Liubov Dmitrieva  <liubov.dmitrieva@intel.com>
 
 	[BZ #15674]
+	* string/test-memcmp.c (check2): New.
+	(main): Call check2.
+
 	* sysdeps/x86_64/multiarch/memcmp-ssse3.S: Fix buffers overrun.
 
 2013-06-26  Maciej W. Rozycki  <macro@codesourcery.com>
diff --git a/string/test-memcmp.c b/string/test-memcmp.c
index b30e34d..0420cd0 100644
--- a/string/test-memcmp.c
+++ b/string/test-memcmp.c
@@ -448,6 +448,29 @@ check1 (void)
     }
 }
 
+/* This test checks that memcmp doesn't overrun buffers.  */
+static void
+check2 (void)
+{
+  size_t max_length = page_size / sizeof (CHAR);
+
+  /* Initialize buf2 to the same values as buf1.  The bug requires the
+     last compared byte to be different.  */
+  memcpy (buf2, buf1, page_size);
+  ((char *) buf2)[page_size - 1] ^= 0x11;
+
+  for (size_t length = 1; length < max_length; length++)
+    {
+      CHAR *s1 = (CHAR *) buf1 + max_length - length;
+      CHAR *s2 = (CHAR *) buf2 + max_length - length;
+
+      const int exp_result = SIMPLE_MEMCMP (s1, s2, length);
+
+      FOR_EACH_IMPL (impl, 0)
+	check_result (impl, s1, s2, length, exp_result);
+    }
+}
+
 int
 test_main (void)
 {
@@ -456,6 +479,7 @@ test_main (void)
   test_init ();
 
   check1 ();
+  check2 ();
 
   printf ("%23s", "");
   FOR_EACH_IMPL (impl, 0)

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

Summary of changes:
 ChangeLog            |    3 +++
 string/test-memcmp.c |   24 ++++++++++++++++++++++++
 2 files changed, 27 insertions(+), 0 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]