summarylogtreecommitdiffstats
path: root/glibc-2.16-strncasecmp-segfault.patch
blob: ce91bbe82ae1eaa93f0f32bcccd1fa8aab644ea3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
diff --git a/string/test-strncasecmp.c b/string/test-strncasecmp.c
index 6c17530..acfe668 100644
--- a/string/test-strncasecmp.c
+++ b/string/test-strncasecmp.c
@@ -1,5 +1,5 @@
 /* Test and measure strncasecmp functions.
-   Copyright (C) 1999, 2002, 2003, 2005, 2010 Free Software Foundation, Inc.
+   Copyright (C) 1999-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Jakub Jelinek <jakub@redhat.com>, 1999.
 
@@ -251,9 +251,9 @@ do_random_tests (void)
     }
 }
 
-
+/* Regression test for BZ #12205 */
 static void
-check1 (void)
+bz12205 (void)
 {
   static char cp [4096+16] __attribute__ ((aligned(4096)));
   static char gotrel[4096] __attribute__ ((aligned(4096)));
@@ -270,6 +270,15 @@ check1 (void)
     check_result (impl, s1, s2, n, exp_result);
 }
 
+/* Regression test for BZ #14195 */
+static void
+bz14195 (void)
+{
+  const char *empty_string  = "";
+  FOR_EACH_IMPL (impl, 0)
+    check_result (impl, empty_string, "", 5, 0);
+}
+
 int
 test_main (void)
 {
@@ -277,7 +286,8 @@ test_main (void)
 
   test_init ();
 
-  check1 ();
+  bz12205 ();
+  bz14195 ();
 
   printf ("%23s", "");
   FOR_EACH_IMPL (impl, 0)
diff --git a/sysdeps/i386/i686/multiarch/strcmp-ssse3.S b/sysdeps/i386/i686/multiarch/strcmp-ssse3.S
index 5e6321e..9735ad0 100644
--- a/sysdeps/i386/i686/multiarch/strcmp-ssse3.S
+++ b/sysdeps/i386/i686/multiarch/strcmp-ssse3.S
@@ -2445,7 +2445,7 @@ L(less16bytes_sncmp):
 # endif
 	jne	L(neq_sncmp)
 	test	%cl, %cl
-	je	L(eq)
+	je	L(eq_sncmp)
 
 	cmp	$1, REM
 	je	L(eq_sncmp)
-- 
1.7.3.4