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=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, 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;