kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] ALSA: seq_midi_emul: small array underflow
@ 2015-03-03  9:38 Dan Carpenter
  2015-03-03 11:21 ` [alsa-devel] " Clemens Ladisch
  0 siblings, 1 reply; 6+ messages in thread
From: Dan Carpenter @ 2015-03-03  9:38 UTC (permalink / raw)
  To: Jaroslav Kysela; +Cc: Takashi Iwai, alsa-devel, kernel-janitors

In snd_opl3_calc_pitch() then the limit is:

	if (pitchbend > 0x1FFF)
		pitchbend = 0x1FFF;

But it can underflow meaning that segment can be as low as
SHORT_MIN / 0x1000 and we can read 6 elements before the start of the
opl3_note_table[] array.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/include/sound/seq_midi_emul.h b/include/sound/seq_midi_emul.h
index 8139d8c..c02b840 100644
--- a/include/sound/seq_midi_emul.h
+++ b/include/sound/seq_midi_emul.h
@@ -44,7 +44,7 @@ struct snd_midi_channel {
 	unsigned char midi_aftertouch;	/* Aftertouch (key pressure) */
 	unsigned char midi_pressure;	/* Channel pressure */
 	unsigned char midi_program;	/* Instrument number */
-	short midi_pitchbend;		/* Pitch bend amount */
+	unsigned short midi_pitchbend;	/* Pitch bend amount */
 
 	unsigned char control[128];	/* Current value of all controls */
 	unsigned char note[128];	/* Current status for all notes */

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-03-03 21:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-03  9:38 [patch] ALSA: seq_midi_emul: small array underflow Dan Carpenter
2015-03-03 11:21 ` [alsa-devel] " Clemens Ladisch
2015-03-03 11:38   ` Dan Carpenter
2015-03-03 19:13   ` [patch v2] ALSA: opl3: " Dan Carpenter
2015-03-03 20:59     ` [alsa-devel] " Clemens Ladisch
2015-03-03 21:06       ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).