From 2076b88a77d2b3ce627b622a5e5dd0f995f0da70 Mon Sep 17 00:00:00 2001 From: Josh Green Date: Sat, 7 Jun 2008 10:10:49 +0200 Subject: [PATCH] Fix segfault with dmix of 3-bytes formats The i386 and x86-64 dmix may cause segfaults when 3-bytes formats are used due to btsl asm code, which may overcome the buffer end-boundary. The patch changes btsl to btsw so that it doesn't happen. ALSA bug#3341: https://bugtrack.alsa-project.org/alsa-bug/view.php?id=3341 Signed-off-by: Takashi Iwai --- src/pcm/pcm_dmix_i386.h | 4 ++-- src/pcm/pcm_dmix_x86_64.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pcm/pcm_dmix_i386.h b/src/pcm/pcm_dmix_i386.h index 1ae037ae..9ea155d9 100644 --- a/src/pcm/pcm_dmix_i386.h +++ b/src/pcm/pcm_dmix_i386.h @@ -400,7 +400,7 @@ static void MIX_AREAS_24(unsigned int size, "\tmovzwl (%%esi), %%ecx\n" "\tmovl (%%ebx), %%edx\n" "\tsall $16, %%eax\n" - "\t" LOCK_PREFIX "btsl $0, (%%edi)\n" + "\t" LOCK_PREFIX "btsw $0, (%%edi)\n" "\tleal (%%ecx,%%eax,1), %%ecx\n" "\tjc 2f\n" "\t" XSUB " %%edx, %%ecx\n" @@ -505,7 +505,7 @@ static void MIX_AREAS_24_CMOV(unsigned int size, "\tmovzwl (%%esi), %%ecx\n" "\tmovl (%%ebx), %%edx\n" "\tsall $16, %%eax\n" - "\t" LOCK_PREFIX "btsl $0, (%%edi)\n" + "\t" LOCK_PREFIX "btsw $0, (%%edi)\n" "\tleal (%%ecx,%%eax,1), %%ecx\n" "\tjc 2f\n" "\t" XSUB " %%edx, %%ecx\n" diff --git a/src/pcm/pcm_dmix_x86_64.h b/src/pcm/pcm_dmix_x86_64.h index 45627343..b4d0a412 100644 --- a/src/pcm/pcm_dmix_x86_64.h +++ b/src/pcm/pcm_dmix_x86_64.h @@ -287,7 +287,7 @@ static void MIX_AREAS_24(unsigned int size, "\tmovswl (%%rsi), %%ecx\n" "\tmovl (%%rbx), %%edx\n" "\tsall $16, %%eax\n" - "\t" LOCK_PREFIX "btsl $0, (%%rdi)\n" + "\t" LOCK_PREFIX "btsw $0, (%%rdi)\n" "\t.byte 0x67, 0x8d, 0x0c, 0x01\n" "\tjc 2f\n" "\t" XSUB " %%edx, %%ecx\n" -- 2.47.1