about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2009-05-09 06:40:15 +0000
committerUlrich Drepper <drepper@redhat.com>2009-05-09 06:40:15 +0000
commit2221e33e5de0a17eef521b923229b2ede48abaad (patch)
treea239b0228691358c0595afebd0846d72dd73ad36
parentb5f7c4cae0c21e5a80fa2dfd4bacbf3cdeeca6a6 (diff)
downloadglibc-2221e33e5de0a17eef521b923229b2ede48abaad.tar.gz
glibc-2221e33e5de0a17eef521b923229b2ede48abaad.tar.xz
glibc-2221e33e5de0a17eef521b923229b2ede48abaad.zip
* sysdeps/x86_64/memchr.S: Handle invalid buffer pointers when
	count is zero.
-rw-r--r--ChangeLog5
-rw-r--r--sysdeps/x86_64/memchr.S2
2 files changed, 6 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 8dc74b4a80..6926c7e68e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,12 +1,15 @@
 2009-05-08  Ulrich Drepper  <drepper@redhat.com>
 
+	* sysdeps/x86_64/memchr.S: Handle invalid buffer pointers when
+	count is zero.
+
 	* po/da.po: Update from translation team.
 
 2009-05-05  Jakub Jelinek  <jakub@redhat.com>
 
 	* io/sys/stat.h (fstatat64): Guard prototype with __USE_LARGEFILE64,
 	guard __extern_inline wrapper with __USE_ATFILE instead of __USE_GNU.
-		
+
 2009-05-05  Ulrich Drepper  <drepper@redhat.com>
 
 	* sysdeps/unix/sysv/linux/sys/personality.h: Add ADDR_COMPAT_LAYOUT
diff --git a/sysdeps/x86_64/memchr.S b/sysdeps/x86_64/memchr.S
index 09ba6d4f8d..54b7af534c 100644
--- a/sysdeps/x86_64/memchr.S
+++ b/sysdeps/x86_64/memchr.S
@@ -26,7 +26,9 @@ ENTRY (memchr)
 	movq	%rdi, %rcx
 	punpcklbw %xmm1, %xmm1
 	andq	$~15, %rdi
+	testq	%rdx, %rdx
 	punpcklbw %xmm1, %xmm1
+	jz	3f
 	orl	$0xffffffff, %esi
 	movdqa	(%rdi), %xmm0
 	pshufd	$0, %xmm1, %xmm1