[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commits] r11704 - in /fsf/trunk/libc: ChangeLog string/Makefile string/bug-strstr1.c string/str-two-way.h



Author: eglibc
Date: Thu Oct  7 00:03:22 2010
New Revision: 11704

Log:
Import glibc-mainline for 2010-10-07

Added:
    fsf/trunk/libc/string/bug-strstr1.c
Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/string/Makefile
    fsf/trunk/libc/string/str-two-way.h

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Thu Oct  7 00:03:22 2010
@@ -1,3 +1,14 @@
+2010-10-06  Ulrich Drepper  <drepper@xxxxxxxxx>
+
+	* string/bug-strstr1.c: New file.
+	* string/Makefile: Add rules to build and run bug-strstr1.
+
+2010-10-05  Eric Blake  <eblake@xxxxxxxxxx>
+
+	[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@xxxxxxxxx>
 
 	[BZ #12005]

Modified: fsf/trunk/libc/string/Makefile
==============================================================================
--- fsf/trunk/libc/string/Makefile (original)
+++ fsf/trunk/libc/string/Makefile Thu Oct  7 00:03:22 2010
@@ -55,7 +55,8 @@
 		   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
 
@@ -74,6 +75,7 @@
 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

Added: fsf/trunk/libc/string/bug-strstr1.c
==============================================================================
--- fsf/trunk/libc/string/bug-strstr1.c (added)
+++ fsf/trunk/libc/string/bug-strstr1.c Thu Oct  7 00:03:22 2010
@@ -1,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;
+}

Modified: fsf/trunk/libc/string/str-two-way.h
==============================================================================
--- fsf/trunk/libc/string/str-two-way.h (original)
+++ fsf/trunk/libc/string/str-two-way.h Thu Oct  7 00:03:22 2010
@@ -350,8 +350,8 @@
 		     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;
 	    }