[PATCH 1/2] alsa-mixer: Fix reference to too high channel numbers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2016-03-01 at 11:41 +0100, David Henningsson wrote:
> The volume_use is set to ignore, but we continue the volume parsing
> code, potentially referencing somewhere outside the array (which has
> max two channels).
> 
> Signed-off-by: David Henningsson <david.henningsson at canonical.com>
> ---
>  src/modules/alsa/alsa-mixer.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
> index 1fe2a02..c0ab1ba 100644
> --- a/src/modules/alsa/alsa-mixer.c
> +++ b/src/modules/alsa/alsa-mixer.c
> @@ -1768,6 +1768,7 @@ static int element_probe(pa_alsa_element *e, snd_mixer_t *m) {
>                           * channels... */
>                          pa_log_warn("Volume element %s has %u channels. That's too much! I can't handle that!", e->alsa_name, e->n_channels);
>                          e->volume_use = PA_ALSA_VOLUME_IGNORE;
> +                        e->n_channels = 2;

I don't like setting e->n_channels to 2, the value has nothing to do
with reality. The real bug is that we continue inspecting the element
after we have decided to ignore it. The refactoring patch seems to fix
the bug properly (it still sets n_channels to 2, but that can be
removed).

I didn't review the refactoring patch properly yet, I'll try to do it
soon.

-- 
Tanu


[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux