GNU C Library master sources branch, release/2.12/master, updated. glibc-2.12.1-7-gfc0ed7b

schwab@sourceware.org schwab@sourceware.org
Fri Oct 8 10:55:00 GMT 2010


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, release/2.12/master has been updated
       via  fc0ed7b647474cdd16efe8cbbc9eb9ccf8a7b3c8 (commit)
       via  e6620c0a4451cd24e04b9cc12d462c54b914503f (commit)
       via  b422509e58a21f1343e49f6f52e224520fab98a1 (commit)
      from  fdae8096fe71e65f7c13575c990eb2652a328122 (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://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=fc0ed7b647474cdd16efe8cbbc9eb9ccf8a7b3c8

commit fc0ed7b647474cdd16efe8cbbc9eb9ccf8a7b3c8
Author: Ulrich Drepper <drepper@gmail.com>
Date:   Wed Oct 6 13:48:51 2010 -0400

    Add test case for strstr problem.
    (cherry picked from commit 67a67b950be9741a4cf1ff3e75572204b06bec2e)

diff --git a/ChangeLog b/ChangeLog
index 4391990..b3da5ad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-10-06  Ulrich Drepper  <drepper@gmail.com>
+
+	* string/bug-strstr1.c: New file.
+	* string/Makefile: Add rules to build and run bug-strstr1.
+
 2010-10-05  Eric Blake  <eblake@redhat.com>
 
 	[BZ #12092]
diff --git a/string/Makefile b/string/Makefile
index db9b508..4ade150 100644
--- a/string/Makefile
+++ b/string/Makefile
@@ -54,7 +54,8 @@ tests		:= tester inl-tester noinl-tester testcopy test-ffs	\
 		   bug-strncat1 bug-strspn1 bug-strpbrk1 tst-bswap	\
 		   tst-strtok tst-strxfrm bug-strcoll1 tst-strfry	\
 		   bug-strtok1 $(addprefix test-,$(strop-tests))	\
-		   bug-envz1 tst-strxfrm2 tst-endian tst-svc2
+		   bug-envz1 tst-strxfrm2 tst-endian tst-svc2		\
+		   bug-strstr1
 distribute	:= memcopy.h pagecopy.h tst-svc.expect test-string.h	\
 		   str-two-way.h
 
@@ -73,6 +74,7 @@ CFLAGS-tst-strlen.c = -fno-builtin
 CFLAGS-stratcliff.c = -fno-builtin
 CFLAGS-test-ffs.c = -fno-builtin
 CFLAGS-tst-inlcall.c = -fno-builtin
+CFLAGS-bug-strstr1.c = -fno-builtin
 
 ifeq ($(cross-compiling),no)
 tests: $(objpfx)tst-svc.out

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=e6620c0a4451cd24e04b9cc12d462c54b914503f

commit e6620c0a4451cd24e04b9cc12d462c54b914503f
Author: Eric Blake <eblake@redhat.com>
Date:   Wed Oct 6 13:48:07 2010 -0400

    Fix strstr and memmem algorithm.
    (cherry picked from commit 5fb308bca2f333dcc835945be85e165cd7843d5b)

diff --git a/ChangeLog b/ChangeLog
index 08e1f75..4391990 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-10-05  Eric Blake  <eblake@redhat.com>
+
+	[BZ #12092]
+	* string/str-two-way.h (two_way_long_needle): Always clear memory
+	when skipping input due to the shift table.
+
 2010-10-03  Ulrich Drepper  <drepper@gmail.com>
 
 	[BZ #12077]
diff --git a/string/bug-strstr1.c b/string/bug-strstr1.c
new file mode 100644
index 0000000..889de12
--- /dev/null
+++ b/string/bug-strstr1.c
@@ -0,0 +1,26 @@
+#include <stdio.h>
+#include <string.h>
+
+int main (int argc, char** argv)
+{
+  const char haystack[] =
+    "F_BD_CE_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_C3_88_20_EF_BF_BD_EF_BF_BD_EF_BF_BD_C3_A7_20_EF_BF_BD";
+
+  const char needle[] =
+    "_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD";
+
+  const char* sub = strstr (haystack, needle);
+
+  if (sub != NULL)
+    {
+      int j;
+
+      fprintf (stderr, "BUG: expected NULL, got:\n%s\n%s\n", sub, needle);
+      for (j = 0; needle[j] != '\0'; ++j)
+        putchar (needle[j] == sub[j] ? ' ' : '^');
+      puts ("");
+      return 1;
+    }
+
+  return 0;
+}
diff --git a/string/str-two-way.h b/string/str-two-way.h
index 87ed8a0..73c99d9 100644
--- a/string/str-two-way.h
+++ b/string/str-two-way.h
@@ -350,8 +350,8 @@ two_way_long_needle (const unsigned char *haystack, size_t haystack_len,
 		     a byte out of place, there can be no match until
 		     after the mismatch.  */
 		  shift = needle_len - period;
-		  memory = 0;
 		}
+	      memory = 0;
 	      j += shift;
 	      continue;
 	    }

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=b422509e58a21f1343e49f6f52e224520fab98a1

commit b422509e58a21f1343e49f6f52e224520fab98a1
Author: Ulrich Drepper <drepper@gmail.com>
Date:   Sun Oct 3 22:10:30 2010 -0400

    Fix handling of tail bytes of buffer in SSE2/SSSE3 x86-64 version strncmp
    (cherry picked from commit 45db99c7d03e497a3320907e722270fb7ee852f3)

diff --git a/ChangeLog b/ChangeLog
index b67439f..08e1f75 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2010-10-03  Ulrich Drepper  <drepper@gmail.com>
+
+	[BZ #12077]
+	* sysdeps/x86_64/strcmp.S: Fix handling of remaining bytes in buffer
+	for strncmp.
+	* string/stratcliff.c: Add tests for strcmp and strncmp.
+	* wcsmbs/wcsatcliff.c: Adjust for stratcliff change.
+
 2010-08-19  Andreas Schwab  <schwab@redhat.com>
 
 	* sysdeps/i386/i686/multiarch/strspn.S [!SHARED]: Fix SSE4.2 check.
diff --git a/string/stratcliff.c b/string/stratcliff.c
index 2bb5982..5165be2 100644
--- a/string/stratcliff.c
+++ b/string/stratcliff.c
@@ -1,5 +1,6 @@
 /* Test for string function add boundaries of usable memory.
-   Copyright (C) 1996,1997,1999-2003,2007, 2009 Free Software Foundation, Inc.
+   Copyright (C) 1996,1997,1999-2003,2007,2009,2010
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -47,6 +48,8 @@
 # define MEMCPY memcpy
 # define MEMPCPY mempcpy
 # define MEMCHR memchr
+# define STRCMP strcmp
+# define STRNCMP strncmp
 #endif
 
 
@@ -70,12 +73,12 @@ do_test (void)
   if (adr == MAP_FAILED || dest == MAP_FAILED)
     {
       if (errno == ENOSYS)
-        puts ("No test, mmap not available.");
+	puts ("No test, mmap not available.");
       else
-        {
-          printf ("mmap failed: %m");
-          result = 1;
-        }
+	{
+	  printf ("mmap failed: %m");
+	  result = 1;
+	}
     }
   else
     {
@@ -93,8 +96,8 @@ do_test (void)
 
       /* strlen/wcslen test */
       for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
-        {
-          for (inner = MAX (outer, nchars - 64); inner < nchars; ++inner)
+	{
+	  for (inner = MAX (outer, nchars - 64); inner < nchars; ++inner)
 	    {
 	      adr[inner] = L('\0');
 
@@ -107,12 +110,12 @@ do_test (void)
 
 	      adr[inner] = L('T');
 	    }
-        }
+	}
 
       /* strnlen/wcsnlen test */
       for (outer = nchars; outer >= MAX (0, nchars - 128); --outer)
-        {
-          for (inner = MAX (outer, nchars - 64); inner < nchars; ++inner)
+	{
+	  for (inner = MAX (outer, nchars - 64); inner < nchars; ++inner)
 	    {
 	      adr[inner] = L('\0');
 
@@ -126,9 +129,9 @@ do_test (void)
 
 	      adr[inner] = L('T');
 	    }
-        }
+	}
       for (outer = nchars; outer >= MAX (0, nchars - 128); --outer)
-        {
+	{
 	  for (inner = MAX (outer, nchars - 64); inner <= nchars; ++inner)
 	    {
 	      if (STRNLEN (&adr[outer], inner - outer)
@@ -139,11 +142,11 @@ do_test (void)
 		  result = 1;
 		}
 	    }
-        }
+	}
 
       /* strchr/wcschr test */
       for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
-        {
+	{
 	  for (middle = MAX (outer, nchars - 64); middle < nchars; ++middle)
 	    {
 	      for (inner = middle; inner < nchars; ++inner)
@@ -167,7 +170,7 @@ do_test (void)
 		  adr[middle] = L('T');
 		}
 	    }
-        }
+	}
 
       /* Special test.  */
       adr[nchars - 1] = L('\0');
@@ -180,7 +183,7 @@ do_test (void)
 
       /* strrchr/wcsrchr test */
       for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
-        {
+	{
 	  for (middle = MAX (outer, nchars - 64); middle < nchars; ++middle)
 	    {
 	      for (inner = middle; inner < nchars; ++inner)
@@ -204,11 +207,11 @@ do_test (void)
 		  adr[middle] = L('T');
 		}
 	    }
-        }
+	}
 
       /* memchr test */
       for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
-        {
+	{
 	  for (middle = MAX (outer, nchars - 64); middle < nchars; ++middle)
 	    {
 	      adr[middle] = L('V');
@@ -224,9 +227,9 @@ do_test (void)
 
 	      adr[middle] = L('T');
 	    }
-        }
+	}
       for (outer = nchars; outer >= MAX (0, nchars - 128); --outer)
-        {
+	{
 	  CHAR *cp = MEMCHR (&adr[outer], L('V'), nchars - outer);
 
 	  if (cp != NULL)
@@ -235,13 +238,13 @@ do_test (void)
 		      STRINGIFY (MEMCHR), outer);
 	      result = 1;
 	    }
-        }
+	}
 
       /* This function only exists for single-byte characters.  */
 #ifndef WCSTEST
       /* rawmemchr test */
       for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
-        {
+	{
 	  for (middle = MAX (outer, nchars - 64); middle < nchars; ++middle)
 	    {
 	      adr[middle] = L('V');
@@ -257,13 +260,13 @@ do_test (void)
 
 	      adr[middle] = L('T');
 	    }
-        }
+	}
 #endif
 
       /* strcpy/wcscpy test */
       for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
-        {
-          for (inner = MAX (outer, nchars - 64); inner < nchars; ++inner)
+	{
+	  for (inner = MAX (outer, nchars - 64); inner < nchars; ++inner)
 	    {
 	      adr[inner] = L('\0');
 
@@ -277,7 +280,74 @@ do_test (void)
 
 	      adr[inner] = L('T');
 	    }
-        }
+	}
+
+      /* strcmp/wcscmp tests */
+      for (outer = 1; outer < 32; ++outer)
+	for (middle = 0; middle < 16; ++middle)
+	  {
+	    MEMSET (adr + middle, L('T'), 256);
+	    adr[256] = L('\0');
+	    MEMSET (dest + nchars - outer, L('T'), outer - 1);
+	    dest[nchars - 1] = L('\0');
+
+	    if (STRCMP (adr + middle, dest + nchars - outer) <= 0)
+	      {
+		printf ("%s 1 flunked for outer = %d, middle = %d\n",
+			STRINGIFY (STRCMP), outer, middle);
+		result = 1;
+	      }
+
+	    if (STRCMP (dest + nchars - outer, adr + middle) >= 0)
+	      {
+		printf ("%s 2 flunked for outer = %d, middle = %d\n",
+			STRINGIFY (STRCMP), outer, middle);
+		result = 1;
+	      }
+	  }
+
+      /* strncmp/wcsncmp tests */
+      for (outer = 1; outer < 32; ++outer)
+	for (middle = 0; middle < 16; ++middle)
+	  {
+	    MEMSET (adr + middle, L('T'), 256);
+	    adr[256] = L('\0');
+	    MEMSET (dest + nchars - outer, L('T'), outer - 1);
+	    dest[nchars - 1] = L('U');
+
+	    for (inner = 0; inner < outer; ++inner)
+	      {
+		if (STRNCMP (adr + middle, dest + nchars - outer, inner) != 0)
+		  {
+		    printf ("%s 1 flunked for outer = %d, middle = %d, "
+			    "inner = %d\n",
+			    STRINGIFY (STRNCMP), outer, middle, inner);
+		    result = 1;
+		  }
+
+		if (STRNCMP (dest + nchars - outer, adr + middle, inner) != 0)
+		  {
+		    printf ("%s 2 flunked for outer = %d, middle = %d, "
+			    "inner = %d\n",
+			    STRINGIFY (STRNCMP), outer, middle, inner);
+		    result = 1;
+		  }
+	      }
+
+	    if (STRNCMP (adr + middle, dest + nchars - outer, outer) >= 0)
+	      {
+		printf ("%s 1 flunked for outer = %d, middle = %d, full\n",
+			STRINGIFY (STRNCMP), outer, middle);
+		result = 1;
+	      }
+
+	    if (STRNCMP (dest + nchars - outer, adr + middle, outer) <= 0)
+	      {
+		printf ("%s 2 flunked for outer = %d, middle = %d, full\n",
+			STRINGIFY (STRNCMP), outer, middle);
+		result = 1;
+	      }
+	  }
 
       /* strncpy/wcsncpy tests */
       adr[nchars - 1] = L('T');
@@ -295,12 +365,12 @@ do_test (void)
 		  result = 1;
 		}
 	    }
-        }
+	}
       adr[nchars - 1] = L('\0');
 
       for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
-        {
-          for (inner = MAX (outer, nchars - 64); inner < nchars; ++inner)
+	{
+	  for (inner = MAX (outer, nchars - 64); inner < nchars; ++inner)
 	    {
 	      size_t len;
 
@@ -334,12 +404,12 @@ do_test (void)
 
 	      adr[inner] = L('T');
 	    }
-        }
+	}
 
       /* stpcpy/wcpcpy test */
       for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
-        {
-          for (inner = MAX (outer, nchars - 64); inner < nchars; ++inner)
+	{
+	  for (inner = MAX (outer, nchars - 64); inner < nchars; ++inner)
 	    {
 	      adr[inner] = L('\0');
 
@@ -352,7 +422,7 @@ do_test (void)
 
 	      adr[inner] = L('T');
 	    }
-        }
+	}
 
       /* stpncpy/wcpncpy test */
       adr[nchars - 1] = L('T');
@@ -374,8 +444,8 @@ do_test (void)
       adr[nchars - 1] = L('\0');
 
       for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
-        {
-          for (middle = MAX (outer, nchars - 64); middle < nchars; ++middle)
+	{
+	  for (middle = MAX (outer, nchars - 64); middle < nchars; ++middle)
 	    {
 	      adr[middle] = L('\0');
 
@@ -393,7 +463,7 @@ do_test (void)
 
 	      adr[middle] = L('T');
 	    }
-        }
+	}
 
       /* memcpy/wmemcpy test */
       for (outer = nchars; outer >= MAX (0, nchars - 128); --outer)
diff --git a/sysdeps/x86_64/strcmp.S b/sysdeps/x86_64/strcmp.S
index ac3fe14..9ce20a6 100644
--- a/sysdeps/x86_64/strcmp.S
+++ b/sysdeps/x86_64/strcmp.S
@@ -320,7 +320,7 @@ LABEL(nibble_ashr_1):
 	jnz	LABEL(ashr_1_exittail)	/* find null char*/
 
 # ifdef USE_AS_STRNCMP
-	cmp	$14, %r11
+	cmp	$15, %r11
 	jbe	LABEL(ashr_1_exittail)
 # endif
 
@@ -445,7 +445,7 @@ LABEL(nibble_ashr_2):
 	jnz	LABEL(ashr_2_exittail)
 
 # ifdef USE_AS_STRNCMP
-	cmp	$13, %r11
+	cmp	$14, %r11
 	jbe	LABEL(ashr_2_exittail)
 # endif
 
@@ -567,7 +567,7 @@ LABEL(nibble_ashr_3):
 	jnz	LABEL(ashr_3_exittail)
 
 # ifdef USE_AS_STRNCMP
-	cmp	$12, %r11
+	cmp	$13, %r11
 	jbe	LABEL(ashr_3_exittail)
 # endif
 
@@ -689,7 +689,7 @@ LABEL(nibble_ashr_4):
 	jnz	LABEL(ashr_4_exittail)
 
 # ifdef USE_AS_STRNCMP
-	cmp	$11, %r11
+	cmp	$12, %r11
 	jbe	LABEL(ashr_4_exittail)
 # endif
 
@@ -811,7 +811,7 @@ LABEL(nibble_ashr_5):
 	jnz	LABEL(ashr_5_exittail)
 
 # ifdef USE_AS_STRNCMP
-	cmp	$10, %r11
+	cmp	$11, %r11
 	jbe	LABEL(ashr_5_exittail)
 # endif
 
@@ -933,7 +933,7 @@ LABEL(nibble_ashr_6):
 	jnz	LABEL(ashr_6_exittail)
 
 # ifdef USE_AS_STRNCMP
-	cmp	$9, %r11
+	cmp	$10, %r11
 	jbe	LABEL(ashr_6_exittail)
 # endif
 
@@ -1055,7 +1055,7 @@ LABEL(nibble_ashr_7):
 	jnz	LABEL(ashr_7_exittail)
 
 # ifdef USE_AS_STRNCMP
-	cmp	$8, %r11
+	cmp	$9, %r11
 	jbe	LABEL(ashr_7_exittail)
 # endif
 
@@ -1177,7 +1177,7 @@ LABEL(nibble_ashr_8):
 	jnz	LABEL(ashr_8_exittail)
 
 # ifdef USE_AS_STRNCMP
-	cmp	$7, %r11
+	cmp	$8, %r11
 	jbe	LABEL(ashr_8_exittail)
 # endif
 
@@ -1299,7 +1299,7 @@ LABEL(nibble_ashr_9):
 	jnz	LABEL(ashr_9_exittail)
 
 # ifdef USE_AS_STRNCMP
-	cmp	$6, %r11
+	cmp	$7, %r11
 	jbe	LABEL(ashr_9_exittail)
 # endif
 
@@ -1421,7 +1421,7 @@ LABEL(nibble_ashr_10):
 	jnz	LABEL(ashr_10_exittail)
 
 # ifdef USE_AS_STRNCMP
-	cmp	$5, %r11
+	cmp	$6, %r11
 	jbe	LABEL(ashr_10_exittail)
 # endif
 
@@ -1543,7 +1543,7 @@ LABEL(nibble_ashr_11):
 	jnz	LABEL(ashr_11_exittail)
 
 # ifdef USE_AS_STRNCMP
-	cmp	$4, %r11
+	cmp	$5, %r11
 	jbe	LABEL(ashr_11_exittail)
 # endif
 
@@ -1665,7 +1665,7 @@ LABEL(nibble_ashr_12):
 	jnz	LABEL(ashr_12_exittail)
 
 # ifdef USE_AS_STRNCMP
-	cmp	$3, %r11
+	cmp	$4, %r11
 	jbe	LABEL(ashr_12_exittail)
 # endif
 
@@ -1787,7 +1787,7 @@ LABEL(nibble_ashr_13):
 	jnz	LABEL(ashr_13_exittail)
 
 # ifdef USE_AS_STRNCMP
-	cmp	$2, %r11
+	cmp	$3, %r11
 	jbe	LABEL(ashr_13_exittail)
 # endif
 
@@ -1909,7 +1909,7 @@ LABEL(nibble_ashr_14):
 	jnz	LABEL(ashr_14_exittail)
 
 # ifdef USE_AS_STRNCMP
-	cmp	$1, %r11
+	cmp	$2, %r11
 	jbe	LABEL(ashr_14_exittail)
 # endif
 
@@ -2033,8 +2033,8 @@ LABEL(nibble_ashr_15):
 	jnz	LABEL(ashr_15_exittail)
 
 # ifdef USE_AS_STRNCMP
-	test	%r11, %r11
-	je	LABEL(ashr_15_exittail)
+	cmpq	$1, %r11
+	jbe	LABEL(ashr_15_exittail)
 # endif
 
 	pxor	%xmm0, %xmm0
diff --git a/wcsmbs/wcsatcliff.c b/wcsmbs/wcsatcliff.c
index b29571f..95afff6 100644
--- a/wcsmbs/wcsatcliff.c
+++ b/wcsmbs/wcsatcliff.c
@@ -16,6 +16,8 @@
 #define MEMCPY wmemcpy
 #define MEMPCPY wmempcpy
 #define MEMCHR wmemchr
+#define STRCMP wcscmp
+#define STRNCMP wcsncmp
 
 
 #include "../string/stratcliff.c"

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

Summary of changes:
 ChangeLog               |   19 ++++++
 string/Makefile         |    4 +-
 string/bug-strstr1.c    |   26 +++++++++
 string/str-two-way.h    |    2 +-
 string/stratcliff.c     |  144 +++++++++++++++++++++++++++++++++++------------
 sysdeps/x86_64/strcmp.S |   32 +++++-----
 wcsmbs/wcsatcliff.c     |    2 +
 7 files changed, 174 insertions(+), 55 deletions(-)
 create mode 100644 string/bug-strstr1.c


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



More information about the Glibc-cvs mailing list