[pypy-commit] cffi default: Oops. Using memcpy() here can be bogus because the addresses can overlap.

arigo noreply at buildbot.pypy.org
Sun Jul 6 19:29:13 CEST 2014


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r1549:133eb25752ff
Date: 2014-07-06 19:29 +0200
http://bitbucket.org/cffi/cffi/changeset/133eb25752ff/

Log:	Oops. Using memcpy() here can be bogus because the addresses can
	overlap.

diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c
--- a/c/_cffi_backend.c
+++ b/c/_cffi_backend.c
@@ -1959,7 +1959,7 @@
         if ((ctv->ct_flags & CT_ARRAY) && (ctv->ct_itemdescr == ct) &&
             (get_array_length((CDataObject *)v) == length)) {
             /* fast path: copying from exactly the correct type */
-            memcpy(cdata, ((CDataObject *)v)->c_data, itemsize * length);
+            memmove(cdata, ((CDataObject *)v)->c_data, itemsize * length);
             return 0;
         }
     }


More information about the pypy-commit mailing list