Skip to contentSkip to conversation

Bug: LADSPA implementation - no up/downmix handling

DISCUSSION Andreas Hartmann 2 participants 6 messages Sep 12, 2015 – Oct 2, 2015 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

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.

Andreas

#1 lore raw

Am Samstag, 12. September 2015, 22:10:40 schrieb Andreas Hartmann:

Quoted 9 lines

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.

Andreas

ping

#2 lore raw
In reply to Andreas Hartmann
Quoted 8 lines · Andreas Hartmann

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

#3 lore raw

Am Mittwoch, 23. September 2015, 16:26:58 schrieb Takashi Iwai:

Quoted 14 lines

On Sat, 12 Sep 2015 22:10:40 +0200,

Quoted 7 lines · Andreas Hartmann

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?

Quoted 7 lines

thanks,

Takashi
_______________________________________________
Alsa-devel mailing list
[email protected]
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 ?? ()

#4 lore raw
Quoted 37 lines · Andreas Hartmann

Am Mittwoch, 23. September 2015, 16:26:58 schrieb Takashi Iwai:

Quoted 14 lines

On Sat, 12 Sep 2015 22:10:40 +0200,

Quoted 7 lines · Andreas Hartmann

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?

Quoted 7 lines

thanks,

Takashi
_______________________________________________
Alsa-devel mailing list
[email protected]
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>,

Quoted 2 lines
    stack_end=0x7fffffffde18) at libc-start.c:287

#6 0x0000000000402fdd in ?? ()

It looks rather like a simply typo. Does the patch below work?

Takashi

src/pcm/pcm_ladspa.c +1 -1
index 631ee0f35b73..6552b4379ec0 100644
@@ -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;

A message that is not in the archive (sent off-list or not yet received): 2508294.jvp4p1Q0mz@deep-thought

#6 lore raw
Quoted 53 lines · Andreas Hartmann

Am Donnerstag, 24. September 2015, 15:07:14 schrieben Sie:

Quoted 51 lines

On Thu, 24 Sep 2015 12:44:53 +0200,

Quoted 39 lines · Andreas Hartmann

Am Mittwoch, 23. September 2015, 16:26:58 schrieb Takashi Iwai:

Quoted 16 lines

On Sat, 12 Sep 2015 22:10:40 +0200,

Quoted 9 lines · Andreas Hartmann

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?

Quoted 7 lines

thanks,

Takashi
_______________________________________________
Alsa-devel mailing list
[email protected]
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>,

Quoted 3 lines
    stack_end=0x7fffffffde18) at libc-start.c:287

#6 0x0000000000402fdd in ?? ()

It looks rather like a simply typo. Does the patch below work?

Takashi

Quoted 15 lines

src/pcm/pcm_ladspa.c static int snd_pcm_ladspa_allocate_memory(snd_pcm_t · line 755

Quoted 13 lines
src/pcm/pcm_ladspa.c +1 -1
index 631ee0f35b73..6552b4379ec0 100644
@@ -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;

It seems to work

Sorry, I forgot to apply this to upstream. Now pushed out.

thanks,

Takashi