]> git.alsa-project.org Git - alsa-tools.git/commitdiff
hdspmixer: Fix preset activation segfault on AES(32)
authorAdrian Knoth <adi@drcomp.erfurt.thur.de>
Mon, 7 Mar 2011 18:03:03 +0000 (19:03 +0100)
committerTakashi Iwai <tiwai@suse.de>
Tue, 8 Mar 2011 12:03:43 +0000 (13:03 +0100)
When selecting preset 6 or 7 on AES(32), hdspmixer has caused a segfault
due to indirect out of bound access on the destination label array.

The amount of destinations is the number of physical stereo
pairs, so it's usually half the channel count, in some cases one more if
there are additional headphone jacks.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
hdspmixer/src/HDSPMixerWindow.cxx

index f52470fddded9bed843c720347968dbd475838a7..8c057e0d60fa0a1b5eaf8e7b4d42913558744009 100644 (file)
@@ -582,9 +582,9 @@ void HDSPMixerWindow::restoreDefaults(int card)
       chnls[0] = 16;
       chnls[1] = 16;
       chnls[2] = 16;
-      maxdest[0] = 16;
-      maxdest[1] = 16;
-      maxdest[2] = 16;
+      maxdest[0] = 8;
+      maxdest[1] = 8;
+      maxdest[2] = 8;
       num_modes = 3;
       break;
      case HDSPeAIO:
@@ -610,6 +610,7 @@ void HDSPMixerWindow::restoreDefaults(int card)
        /* should never happen */
        return;
     }
+
     for (int preset = 0; preset < 8; ++preset) {
        for (int speed = 0; speed < num_modes; ++speed) {
            for (int i = 0; i < chnls[speed]; i+=2) {