From: ronag Date: Tue, 25 Oct 2011 09:28:40 +0000 (+0000) Subject: 2.0.2: memcpy: Added alignment check for safety. X-Git-Tag: 2.0.0.2~17 X-Git-Url: https://git.sesse.net/?p=casparcg;a=commitdiff_plain;h=1844640096fb62ea9adf813cb9b468f6c86e365f 2.0.2: memcpy: Added alignment check for safety. git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches/2.0.0.2@1455 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d --- diff --git a/common/memory/memcpy.h b/common/memory/memcpy.h index 68323039a..57ab081e0 100644 --- a/common/memory/memcpy.h +++ b/common/memory/memcpy.h @@ -73,6 +73,9 @@ static void* fast_memcpy(void* dest, const void* source, size_t count) static void* fast_memcpy(void* dest, const void* source, size_t count) { + if((reinterpret_cast(source) & 15) || (reinterpret_cast(dest) & 15)) + return memcpy(dest, source, count); + if(count < 2048) return memcpy(dest, source, count);