aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRamiro Polla <ramiro.polla@gmail.com>2024-09-01 14:56:44 +0200
committerRamiro Polla <ramiro.polla@gmail.com>2024-09-06 23:05:04 +0200
commit4c824ad391d543c3325ea3402a7d34d498b6e1f7 (patch)
tree3394f145a74b568dd248a598329667493ed1d204
parentf17a6bd2000a82a7b5a1af8ee14e1f26d684c5a9 (diff)
downloadffmpeg-4c824ad391d543c3325ea3402a7d34d498b6e1f7.tar.gz
swscale/x86/rgb2rgb: fix deinterleaveBytes writing past the end of the buffers
-rw-r--r--libswscale/x86/rgb2rgb.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libswscale/x86/rgb2rgb.c b/libswscale/x86/rgb2rgb.c
index 4d6ba9ff21..1617c33338 100644
--- a/libswscale/x86/rgb2rgb.c
+++ b/libswscale/x86/rgb2rgb.c
@@ -2380,7 +2380,12 @@ static void deinterleave_bytes_ ## cpuext(const uint8_t *src, uint8_t *dst1, uin
int dst1Stride, int dst2Stride) \
{ \
for (int h = 0; h < height; h++) { \
- ff_nv12ToUV_ ## cpuext(dst1, dst2, NULL, src, NULL, width, NULL, NULL); \
+ if (width >= 16) \
+ ff_nv12ToUV_ ## cpuext(dst1, dst2, NULL, src, NULL, width - 15, NULL, NULL); \
+ for (int w = (width & (~15)); w < width; w++) { \
+ dst1[w] = src[2*w+0]; \
+ dst2[w] = src[2*w+1]; \
+ } \
src += srcStride; \
dst1 += dst1Stride; \
dst2 += dst2Stride; \