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

Rémi Denis-Courmont git at videolan.org
Fri Oct 12 10:39:52 CEST 2012


vlc/vlc-2.0 | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Oct 11 19:42:03 2012 +0300| [e5d66497557337b9e7aa69ef1dd2a1a2b0f2ad01] | 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-2.0.git/?a=commit;h=e5d66497557337b9e7aa69ef1dd2a1a2b0f2ad01
---

 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 3c27069..c699882 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