diff options
author | Anton Fedchin <afedchin@ruswizards.com> | 2016-01-05 15:06:10 +0300 |
---|---|---|
committer | Anton Fedchin <afedchin@ruswizards.com> | 2016-01-05 15:07:50 +0300 |
commit | daf424530049c449f803d37df61d3bbe0eb3f964 (patch) | |
tree | eacb7dd9b377e306a17f16ac4d1a45ac7ec5e0a7 | |
parent | 614621f5bf902a709ec17674b401a4c8bea1f333 (diff) |
[win32] memcpy_sse2: Fixed possible heap corruption if chroma width is not 16 aligned.
-rw-r--r-- | xbmc/utils/win32/memcpy_sse2.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/xbmc/utils/win32/memcpy_sse2.h b/xbmc/utils/win32/memcpy_sse2.h index d5c5844b58..e6ea34a940 100644 --- a/xbmc/utils/win32/memcpy_sse2.h +++ b/xbmc/utils/win32/memcpy_sse2.h @@ -108,7 +108,17 @@ inline void convert_yuv420_nv12(uint8_t *const src[], const int srcStride[], int _mm_stream_si128((__m128i *)(d + (i << 1) + 32), xmm2); _mm_stream_si128((__m128i *)(d + (i << 1) + 48), xmm1); } - for (; i < chromaWidth; i += 16) + if (((size_t)chromaWidth) & 0xF) + { + d += (i << 1); + u += i; v += i; + for (; i < chromaWidth; ++i) + { + *d++ = *u++; + *d++ = *v++; + } + } + else { xmm0 = _mm_load_si128((__m128i*)(v + i)); xmm1 = _mm_load_si128((__m128i*)(u + i)); |