Browse Source

ALSA: opl3: small array underflow

There is a missing lower bound check on "pitchbend" so it means we can
read up to 6 elements before the start of the opl3_note_table[] array.

Thanks to Clemens Ladisch for his help with this patch.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Dan Carpenter 10 years ago
parent
commit
d124380674
1 changed files with 2 additions and 0 deletions
  1. 2 0
      sound/drivers/opl3/opl3_midi.c

+ 2 - 0
sound/drivers/opl3/opl3_midi.c

@@ -105,6 +105,8 @@ static void snd_opl3_calc_pitch(unsigned char *fnum, unsigned char *blocknum,
 		int pitchbend = chan->midi_pitchbend;
 		int pitchbend = chan->midi_pitchbend;
 		int segment;
 		int segment;
 
 
+		if (pitchbend < -0x2000)
+			pitchbend = -0x2000;
 		if (pitchbend > 0x1FFF)
 		if (pitchbend > 0x1FFF)
 			pitchbend = 0x1FFF;
 			pitchbend = 0x1FFF;