From: Takashi Iwai Subject: Re: Bug: LADSPA implementation - no up/downmix handling Date: Thu, 24 Sep 2015 15:07:14 +0200 Message-ID: References: <2541800.vBPmoIL6Xo@deep-thought> <1544609.lNj7aapdUP@deep-thought> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 1B1A5265A3F for ; Thu, 24 Sep 2015 15:07:15 +0200 (CEST) In-Reply-To: <1544609.lNj7aapdUP@deep-thought> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Andreas Hartmann Cc: alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org On Thu, 24 Sep 2015 12:44:53 +0200, Andreas Hartmann wrote: > > Am Mittwoch, 23. September 2015, 16:26:58 schrieb Takashi Iwai: > > On Sat, 12 Sep 2015 22:10:40 +0200, > > > > Andreas Hartmann wrote: > > > Hi, > > > > > > Using the surround_encoder of the swh-plugins I noticed, that the alsa > > > implementation only assumes an equal number of in- and output channels for > > > ladspa plugins. This occurs from Line 752 onwards in pcm_ladspa.c and > > > leads to a Segfault shortly after. > > > There needs to be a check and correct handling for up/downmix scenarios. > > > > Could you give the back trace? Or at best submit a fix patch? > > > > > > thanks, > > > > Takashi > > _______________________________________________ > > Alsa-devel mailing list > > Alsa-devel@alsa-project.org > > http://mailman.alsa-project.org/mailman/listinfo/alsa-devel > > Sure here you go > > #0 0x00007ffff78623ef in snd_pcm_ladspa_allocate_memory (pcm=0x626fa0, > pcm=0x626fa0, pcm=0x626fa0, ladspa=0x621ad0) at pcm_ladspa.c:753 > #1 snd_pcm_ladspa_init (pcm=0x626fa0) at pcm_ladspa.c:834 > #2 0x00007ffff7842946 in snd_pcm_plugin_prepare (pcm=0x626fa0) at > pcm_plugin.c:171 > #3 0x00007ffff784290f in snd_pcm_plugin_prepare (pcm=0x62c760) at > pcm_plugin.c:162 > #4 0x000000000040256a in ?? () > #5 0x00007ffff7222ec5 in __libc_start_main (main=0x401d80, argc=4, > argv=0x7fffffffde28, init=, fini=, > rtld_fini=, > stack_end=0x7fffffffde18) at libc-start.c:287 > #6 0x0000000000402fdd in ?? () It looks rather like a simply typo. Does the patch below work? Takashi diff --git a/src/pcm/pcm_ladspa.c b/src/pcm/pcm_ladspa.c index 631ee0f35b73..6552b4379ec0 100644 --- a/src/pcm/pcm_ladspa.c +++ b/src/pcm/pcm_ladspa.c @@ -749,7 +749,7 @@ static int snd_pcm_ladspa_allocate_memory(snd_pcm_t *pcm, snd_pcm_ladspa_t *lads return -ENOMEM; } for (idx = 0; idx < instance->input.channels.size; idx++) { - chn = instance->output.channels.array[idx]; + chn = instance->input.channels.array[idx]; if (pchannels[chn] == NULL && chn < ichannels) { instance->input.data[idx] = NULL; continue;