Sourceware Bugzilla – Attachment 5660 Details for
Bug 12518
memcpy acts randomly (and differently) with overlapping areas
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch to check for overlaps
0001-memcpy-overlap-test.patch (text/plain), 1.73 KB, created by
Felipe Contreras
on 2011-04-10 15:49:59 UTC
(
hide
)
Description:
Patch to check for overlaps
Filename:
MIME Type:
Creator:
Felipe Contreras
Created:
2011-04-10 15:49:59 UTC
Size:
1.73 KB
patch
obsolete
>From 3d1895e17136b4a565ffefd37c02a159664017ed Mon Sep 17 00:00:00 2001 >From: Felipe Contreras <felipe.contreras@gmail.com> >Date: Sun, 10 Apr 2011 17:29:44 +0300 >Subject: [PATCH] memcpy overlap test > >Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> >--- > sysdeps/x86_64/multiarch/memcpy-ssse3-back.S | 11 +++++++++++ > sysdeps/x86_64/multiarch/memcpy-ssse3.S | 11 +++++++++++ > 2 files changed, 22 insertions(+), 0 deletions(-) > >diff --git a/sysdeps/x86_64/multiarch/memcpy-ssse3-back.S b/sysdeps/x86_64/multiarch/memcpy-ssse3-back.S >index 48c974e..4e3ee78 100644 >--- a/sysdeps/x86_64/multiarch/memcpy-ssse3-back.S >+++ b/sysdeps/x86_64/multiarch/memcpy-ssse3-back.S >@@ -57,6 +57,17 @@ END (MEMCPY_CHK) > #endif > > ENTRY (MEMCPY) >+#ifndef USE_AS_MEMMOVE >+ lea (%rsi, %rdx), %r9 >+ lea (%rdi, %rdx), %r11 >+ cmp %r9, %rdi /* dest start >= source end */ >+ jae L(nonoverlap) /* -> nonoverlapping */ >+ cmp %r11, %rsi /* source start >= destination end */ >+ jae L(nonoverlap) /* -> nonoverlapping */ >+ movb $0, 0 >+ L(nonoverlap): >+#endif >+ > mov %rdi, %rax > #ifdef USE_AS_MEMPCPY > add %rdx, %rax >diff --git a/sysdeps/x86_64/multiarch/memcpy-ssse3.S b/sysdeps/x86_64/multiarch/memcpy-ssse3.S >index 9a878d3..cc316e8 100644 >--- a/sysdeps/x86_64/multiarch/memcpy-ssse3.S >+++ b/sysdeps/x86_64/multiarch/memcpy-ssse3.S >@@ -57,6 +57,17 @@ END (MEMCPY_CHK) > #endif > > ENTRY (MEMCPY) >+#ifndef USE_AS_MEMMOVE >+ lea (%rsi, %rdx), %r9 >+ lea (%rdi, %rdx), %r11 >+ cmp %r9, %rdi /* dest start >= source end */ >+ jae L(nonoverlap) /* -> nonoverlapping */ >+ cmp %r11, %rsi /* source start >= destination end */ >+ jae L(nonoverlap) /* -> nonoverlapping */ >+ movb $0, 0 >+ L(nonoverlap): >+#endif >+ > mov %rdi, %rax > #ifdef USE_AS_MEMPCPY > add %rdx, %rax >-- >1.7.5.rc1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 12518
:
5264
|
5323
|
5341
| 5660