about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLiubov Dmitrieva <liubov.dmitrieva@gmail.com>2012-08-15 21:06:55 +0200
committerAndreas Jaeger <aj@suse.de>2012-08-16 09:38:27 +0200
commit6db8f73723e64a4f486ca679e05dbf15a1437bfd (patch)
tree67289d3302511ca6f4e81fa218174567c3668a4f
parenta7ef7b6735083a0c6e726cad950f5621517f46d4 (diff)
downloadglibc-6db8f73723e64a4f486ca679e05dbf15a1437bfd.tar.gz
glibc-6db8f73723e64a4f486ca679e05dbf15a1437bfd.tar.xz
glibc-6db8f73723e64a4f486ca679e05dbf15a1437bfd.zip
Fix segmentation fault in strncasecmp for i686
2012-08-15  Liubov Dmitrieva  <liubov.dmitrieva@gmail.com>

	[BZ #14195]
        * sysdeps/i386/i686/multiarch/strcmp-sssse3.S: Fix
        segmentation fault for a case of two empty input strings.
	* string/test-strncasecmp.c (check1): Renamed to...
	(bz12205): ...this.
	(bz14195): Add new testcase for two empty input strings and N > 0.
	(test_main): Call new testcase, adapt for renamed function.
(cherry picked from commit b3f479a85a3e191befbe821d787d7f71c0f64e79)
-rw-r--r--ChangeLog10
-rw-r--r--NEWS6
-rw-r--r--string/test-strncasecmp.c18
-rw-r--r--sysdeps/i386/i686/multiarch/strcmp-ssse3.S2
4 files changed, 31 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 27cf01e573..c64f0ac6ae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2012-08-15  Liubov Dmitrieva  <liubov.dmitrieva@gmail.com>
+
+	[BZ #14195]
+	* sysdeps/i386/i686/multiarch/strcmp-sssse3.S: Fix
+	segmentation fault for a case of two empty input strings.
+	* string/test-strncasecmp.c (check1): Renamed to...
+	(bz12205): ...this.
+	(bz14195): Add new testcase for two empty input strings and N > 0.
+	(test_main): Call new testcase, adapt for renamed function.
+
 2012-07-06  Mike Frysinger  <vapier@gentoo.org>
 
 	* sunrpc/rpc_clntout.c: Change <rpc/types.h> to "rpc/types.h".
diff --git a/NEWS b/NEWS
index a90d95599d..888a123d3e 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,12 @@ See the end for copying conditions.
 Please send GNU C library bug reports via <http://sources.redhat.com/bugzilla/>
 using `glibc' in the "product" field.
 
+Version 2.16.1
+
+* The following bugs are resolved with this release:
+
+  14195
+
 Version 2.16
 
 * The following bugs are resolved with this release:
diff --git a/string/test-strncasecmp.c b/string/test-strncasecmp.c
index 6c17530408..acfe668cab 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 5e6321e539..9735ad00ca 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)