Blame SOURCES/glibc-rh641128.patch

b40826
2010-10-06  Ulrich Drepper  <drepper@gmail.com>
b40826
b40826
	* string/bug-strstr1.c: New file.
b40826
	* string/Makefile: Add rules to build and run bug-strstr1.
b40826
b40826
2010-10-05  Eric Blake  <eblake@redhat.com>
b40826
b40826
	[BZ #12092]
b40826
	* string/str-two-way.h (two_way_long_needle): Always clear memory
b40826
	when skipping input due to the shift table.
b40826
b40826
Index: glibc-2.12-2-gc4ccff1/string/Makefile
b40826
===================================================================
b40826
--- glibc-2.12-2-gc4ccff1.orig/string/Makefile
b40826
+++ glibc-2.12-2-gc4ccff1/string/Makefile
b40826
@@ -54,7 +54,8 @@ tests		:= tester inl-tester noinl-tester
b40826
 		   bug-strncat1 bug-strspn1 bug-strpbrk1 tst-bswap	\
b40826
 		   tst-strtok tst-strxfrm bug-strcoll1 tst-strfry	\
b40826
 		   bug-strtok1 $(addprefix test-,$(strop-tests))	\
b40826
-		   bug-envz1 tst-strxfrm2 tst-endian tst-svc2
b40826
+		   bug-envz1 tst-strxfrm2 tst-endian tst-svc2		\
b40826
+		   bug-strstr1
b40826
 distribute	:= memcopy.h pagecopy.h tst-svc.expect test-string.h	\
b40826
 		   str-two-way.h
b40826
 
b40826
@@ -73,6 +74,7 @@ CFLAGS-tst-strlen.c = -fno-builtin
b40826
 CFLAGS-stratcliff.c = -fno-builtin
b40826
 CFLAGS-test-ffs.c = -fno-builtin
b40826
 CFLAGS-tst-inlcall.c = -fno-builtin
b40826
+CFLAGS-bug-strstr1.c = -fno-builtin
b40826
 
b40826
 ifeq ($(cross-compiling),no)
b40826
 tests: $(objpfx)tst-svc.out
b40826
Index: glibc-2.12-2-gc4ccff1/string/bug-strstr1.c
b40826
===================================================================
b40826
--- /dev/null
b40826
+++ glibc-2.12-2-gc4ccff1/string/bug-strstr1.c
b40826
@@ -0,0 +1,26 @@
b40826
+#include <stdio.h>
b40826
+#include <string.h>
b40826
+
b40826
+int main (int argc, char** argv)
b40826
+{
b40826
+  const char haystack[] =
b40826
+    "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";
b40826
+
b40826
+  const char needle[] =
b40826
+    "_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD";
b40826
+
b40826
+  const char* sub = strstr (haystack, needle);
b40826
+
b40826
+  if (sub != NULL)
b40826
+    {
b40826
+      int j;
b40826
+
b40826
+      fprintf (stderr, "BUG: expected NULL, got:\n%s\n%s\n", sub, needle);
b40826
+      for (j = 0; needle[j] != '\0'; ++j)
b40826
+        putchar (needle[j] == sub[j] ? ' ' : '^');
b40826
+      puts ("");
b40826
+      return 1;
b40826
+    }
b40826
+
b40826
+  return 0;
b40826
+}
b40826
Index: glibc-2.12-2-gc4ccff1/string/str-two-way.h
b40826
===================================================================
b40826
--- glibc-2.12-2-gc4ccff1.orig/string/str-two-way.h
b40826
+++ glibc-2.12-2-gc4ccff1/string/str-two-way.h
b40826
@@ -350,8 +350,8 @@ two_way_long_needle (const unsigned char
b40826
 		     a byte out of place, there can be no match until
b40826
 		     after the mismatch.  */
b40826
 		  shift = needle_len - period;
b40826
-		  memory = 0;
b40826
 		}
b40826
+	      memory = 0;
b40826
 	      j += shift;
b40826
 	      continue;
b40826
 	    }