summaryrefslogtreecommitdiffstats
path: root/src/modules/alsa
diff options
context:
space:
mode:
authorTanu Kaskinen <tanu.kaskinen@digia.com>2011-03-23 14:52:48 +0200
committerColin Guthrie <colin@mageia.org>2011-03-30 09:20:56 +0100
commit527078523815587bfd021bc1d10782403e9b3e84 (patch)
tree76b755c8cbd0c453c77e921942988792f934d569 /src/modules/alsa
parent9501504859cf5f8ab5b700e89c831e8c34c9bae3 (diff)
alsa-mixer: Make probing elements with more than two volume channels fail.
This is just a quick hack to prevent array overflow. Correct fix would be to implement support for more channels.
Diffstat (limited to 'src/modules/alsa')
-rw-r--r--src/modules/alsa/alsa-mixer.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
index 3b13879d..eb8b9433 100644
--- a/src/modules/alsa/alsa-mixer.c
+++ b/src/modules/alsa/alsa-mixer.c
@@ -1477,6 +1477,22 @@ static int element_probe(pa_alsa_element *e, snd_mixer_t *m) {
return -1;
}
+ if (e->n_channels > 2) {
+ /* FIXME: In some places code like this is used:
+ *
+ * e->masks[alsa_channel_ids[p]][e->n_channels-1]
+ *
+ * The definition of e->masks is
+ *
+ * pa_channel_position_mask_t masks[SND_MIXER_SCHN_LAST][2];
+ *
+ * Since the array size is fixed at 2, we obviously
+ * don't support elements with more than two
+ * 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);
+ return -1;
+ }
+
if (!e->override_map) {
for (p = PA_CHANNEL_POSITION_FRONT_LEFT; p < PA_CHANNEL_POSITION_MAX; p++) {
pa_bool_t has_channel;