swscale/x86/yuv_2_rgb: fix access to memory past the frame data in yuv to rgb conversion

Y, U, V data is loaded at the end of the current iteration for the next
iteration.
It results in memory access past the frame data on the last iteration
(that data is never used after the loading).

So load data at the start of the iteration, so that only useful data is
loaded.

Signed-off-by: Vardan Margaryan <v.t.margaryan@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
This commit is contained in:
Vardan Margaryan 2022-05-23 19:06:16 +03:00 committed by Anton Khirnov
parent 72106d6cc3
commit 73302aa193
1 changed files with 1 additions and 4 deletions

View File

@ -139,10 +139,10 @@ cglobal %1_420_%2%3, GPR_num, GPR_num, reg_num, parameters
VBROADCASTSD vr_coff, [pointer_c_ditherq + 4 * 8] VBROADCASTSD vr_coff, [pointer_c_ditherq + 4 * 8]
%endif %endif
%endif %endif
.loop0:
movu m_y, [py_2indexq + 2 * indexq] movu m_y, [py_2indexq + 2 * indexq]
movh m_u, [pu_indexq + indexq] movh m_u, [pu_indexq + indexq]
movh m_v, [pv_indexq + indexq] movh m_v, [pv_indexq + indexq]
.loop0:
pxor m4, m4 pxor m4, m4
mova m7, m6 mova m7, m6
punpcklbw m0, m4 punpcklbw m0, m4
@ -347,9 +347,6 @@ cglobal %1_420_%2%3, GPR_num, GPR_num, reg_num, parameters
%endif ; PACK RGB15/16 %endif ; PACK RGB15/16
%endif ; PACK RGB15/16/32 %endif ; PACK RGB15/16/32
movu m_y, [py_2indexq + 2 * indexq + 8 * time_num]
movh m_v, [pv_indexq + indexq + 4 * time_num]
movh m_u, [pu_indexq + indexq + 4 * time_num]
add imageq, 8 * depth * time_num add imageq, 8 * depth * time_num
add indexq, 4 * time_num add indexq, 4 * time_num
js .loop0 js .loop0