[vlc-commits] avcodec: fix unaligned USWC copy (fixes #6333)

Rémi Denis-Courmont git at videolan.org
Fri Oct 12 18:47:03 CEST 2012


vlc/vlc-1.1 | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Oct 11 19:42:03 2012 +0300| [1d94558181ef353d4230187710de1d0039b2f3c7] | committer: Rémi Denis-Courmont

avcodec: fix unaligned USWC copy (fixes #6333)

(cherry picked from commit 39dc439cf5e3fe83b87078bcf93c13d07fd02dac)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.1.git/?a=commit;h=1d94558181ef353d4230187710de1d0039b2f3c7
---

 modules/codec/avcodec/copy.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/modules/codec/avcodec/copy.c b/modules/codec/avcodec/copy.c
index 9c9a44b..6a5e96b 100644
--- a/modules/codec/avcodec/copy.c
+++ b/modules/codec/avcodec/copy.c
@@ -70,10 +70,10 @@ static void CopyFromUswc(uint8_t *dst, size_t dst_pitch,
 
     ASM_SSE2(cpu, "mfence");
     for (unsigned y = 0; y < height; y++) {
-        const unsigned unaligned = (intptr_t)src & 0x0f;
-        unsigned x;
+        const unsigned unaligned = (-(uintptr_t)src) & 0x0f;
+        unsigned x = 0;
 
-        for (x = 0; x < unaligned; x++)
+        for (; x < unaligned; x++)
             dst[x] = src[x];
 
 #ifdef CAN_COMPILE_SSE4_1



More information about the vlc-commits mailing list