1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-10 06:10:52 +02:00

x86/cfhddsp: zero extend int arguments

if taken from stack, they may have garbage in the upper bits otherwise.
Also, there are only 8 arguments, so don't attempt to load 11.

Fixes SIGSEV crashes in some targets.

Reviewed-by: durandal_1707
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer
2020-08-28 19:40:09 -03:00
parent 2ff3c466ec
commit 1a35fffaf2

View File

@@ -37,29 +37,26 @@ SECTION .text
%macro CFHD_HORIZ_FILTER 1 %macro CFHD_HORIZ_FILTER 1
%if %1 == 1023 %if %1 == 1023
cglobal cfhd_horiz_filter_clip10, 5, 6, 8 + 4 * ARCH_X86_64, output, low, high, width, bpc cglobal cfhd_horiz_filter_clip10, 5, 6, 8 + 4 * ARCH_X86_64, output, low, high, width, x, temp
DEFINE_ARGS output, low, high, width, x, temp
shl widthd, 1 shl widthd, 1
%define ostrideq widthq %define ostrideq widthq
%define lwidthq widthq %define lwidthq widthq
%define hwidthq widthq %define hwidthq widthq
%elif %1 == 4095 %elif %1 == 4095
cglobal cfhd_horiz_filter_clip12, 5, 6, 8 + 4 * ARCH_X86_64, output, low, high, width, bpc cglobal cfhd_horiz_filter_clip12, 5, 6, 8 + 4 * ARCH_X86_64, output, low, high, width, x, temp
DEFINE_ARGS output, low, high, width, x, temp
shl widthd, 1 shl widthd, 1
%define ostrideq widthq %define ostrideq widthq
%define lwidthq widthq %define lwidthq widthq
%define hwidthq widthq %define hwidthq widthq
%else %else
%if ARCH_X86_64 %if ARCH_X86_64
cglobal cfhd_horiz_filter, 11, 11, 12, output, ostride, low, lwidth, high, hwidth, width, height cglobal cfhd_horiz_filter, 8, 11, 12, output, ostride, low, lwidth, high, hwidth, width, height, x, y, temp
DEFINE_ARGS output, ostride, low, lwidth, high, hwidth, width, height, x, y, temp
shl ostrided, 1 shl ostrided, 1
shl lwidthd, 1 shl lwidthd, 1
shl hwidthd, 1 shl hwidthd, 1
shl widthd, 1 shl widthd, 1
mov yq, heightq mov yd, heightd
neg yq neg yq
%else %else
cglobal cfhd_horiz_filter, 7, 7, 8, output, x, low, y, high, temp, width, height cglobal cfhd_horiz_filter, 7, 7, 8, output, x, low, y, high, temp, width, height
@@ -307,14 +304,13 @@ CFHD_HORIZ_FILTER 4095
INIT_XMM sse2 INIT_XMM sse2
%if ARCH_X86_64 %if ARCH_X86_64
cglobal cfhd_vert_filter, 11, 11, 14, output, ostride, low, lwidth, high, hwidth, width, height cglobal cfhd_vert_filter, 8, 11, 14, output, ostride, low, lwidth, high, hwidth, width, height, x, y, pos
DEFINE_ARGS output, ostride, low, lwidth, high, hwidth, width, height, x, y, pos
shl ostrided, 1 shl ostrided, 1
shl lwidthd, 1 shl lwidthd, 1
shl hwidthd, 1 shl hwidthd, 1
shl widthd, 1 shl widthd, 1
dec heightq dec heightd
mova m8, [factor_p1_n1] mova m8, [factor_p1_n1]
mova m9, [factor_n1_p1] mova m9, [factor_n1_p1]