aboutsummaryrefslogtreecommitdiffstats
path: root/libavresample
diff options
context:
space:
mode:
authorRonald S. Bultje <rsbultje@gmail.com>2012-10-29 16:18:04 -0400
committerJustin Ruggles <justin.ruggles@gmail.com>2012-11-17 20:16:04 -0500
commit7a9e65aceee678ee2677480579cb3b2208474140 (patch)
tree005a100af310e23c04aeb0a3d16669b1d0a21d5f /libavresample
parent02738792c5cd18cff8b94deb838db57dbfb4be0a (diff)
downloadffmpeg-7a9e65aceee678ee2677480579cb3b2208474140.tar.gz
x86: lavr: fix stack allocation for 7 and 8 channel downmixing on x86-32
Fixes crashes on Win32 and stack overruns on x86-32 in general.
Diffstat (limited to 'libavresample')
-rw-r--r--libavresample/x86/audio_mix.asm10
1 files changed, 9 insertions, 1 deletions
diff --git a/libavresample/x86/audio_mix.asm b/libavresample/x86/audio_mix.asm
index 47c23e4584..daf0a7b335 100644
--- a/libavresample/x86/audio_mix.asm
+++ b/libavresample/x86/audio_mix.asm
@@ -272,7 +272,15 @@ cglobal mix_%1_to_%2_%3_flt, 3,in_channels+2,needed_mmregs+matrix_elements_mm, s
and rsp, ~(mmsize-1)
sub rsp, matrix_elements_stack * mmsize
%else
- %assign pad matrix_elements_stack * mmsize + (mmsize - gprsize) - (stack_offset & (mmsize - gprsize))
+ %assign matrix_stack_size matrix_elements_stack * mmsize
+ %assign pad matrix_stack_size + (mmsize - gprsize) - (stack_offset & (mmsize - gprsize))
+ ; on x86-32 for 7 and 8 channels we need more stack space for src pointers
+ %if ARCH_X86_32 && in_channels >= 7
+ %assign pad pad + 0x10
+ %define src5m [rsp+matrix_stack_size+0]
+ %define src6m [rsp+matrix_stack_size+4]
+ %define src7m [rsp+matrix_stack_size+8]
+ %endif
SUB rsp, pad
%endif
%endif