Skip to content

Commit

Permalink
ALSA: opl3: small array underflow
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
Dan Carpenter authored and tiwai committed Mar 6, 2015
1 parent f44f07c commit d124380
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sound/drivers/opl3/opl3_midi.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ static void snd_opl3_calc_pitch(unsigned char *fnum, unsigned char *blocknum,
int pitchbend = chan->midi_pitchbend;
int segment;

if (pitchbend < -0x2000)
pitchbend = -0x2000;
if (pitchbend > 0x1FFF)
pitchbend = 0x1FFF;

Expand Down

0 comments on commit d124380

Please sign in to comment.